/* ========================================================
   STATENS PORTEFØLJE - DESIGN SYSTEM & FINANSTERMINAL STYLING
   ======================================================== */

:root {
    /* Base Colors & Palettes */
    --bg-color: #0b0f19;
    --bg-gradient: radial-gradient(circle at 80% 10%, #152238 0%, #0b0f19 70%);
    --panel: #131c2b;
    --panel-hover: #18253a;
    --panel-active: #1d2e48;
    
    /* Text Hierarchy */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-dim: #64748b;
    
    /* Glassmorphism & Borders */
    --card-bg: rgba(19, 28, 43, 0.75);
    --card-border: rgba(255, 255, 255, 0.07);
    --card-border-hover: rgba(56, 189, 248, 0.3);
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.04);
    
    /* Accent & Financial Indicators */
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.25);
    --accent-hover: #0284c7;
    --positive: #10b981;
    --pos: #10b981;
    --positive-bg: rgba(16, 185, 129, 0.12);
    --positive-border: rgba(16, 185, 129, 0.25);
    --negative: #f43f5e;
    --neg: #f43f5e;
    --negative-bg: rgba(244, 63, 94, 0.12);
    --negative-border: rgba(244, 63, 94, 0.25);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    
    /* Typography */
    --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Elevation & Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px -2px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --shadow-lg: 0 12px 36px -4px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    --shadow-glow: 0 0 24px var(--accent-glow);
}

/* ========================================================
   GLOBAL RESETS & BASE STYLES
   ======================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-feature-settings: "tnum" 1, "cv02" 1, "cv03" 1, "cv04" 1, "cv11" 1;
}

a {
    color: inherit;
    text-decoration: none;
}

body {
    background-color: var(--bg-color);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: rgba(11, 15, 25, 0.8);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* ========================================================
   APP LAYOUT & SIDEBAR NAVIGATION
   ======================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: 260px;
    min-width: 260px;
    background: #0d131f;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 16px;
    box-sizing: border-box;
    z-index: 1000;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.35);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px 20px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 22px;
    text-decoration: none;
    color: #fff;
    transition: opacity 0.2s;
}
.sidebar-brand:hover {
    opacity: 0.9;
}

.sidebar-brand-icon {
    font-size: 1.6rem;
    line-height: 1;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(15, 23, 42, 0.8));
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 10px;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: #ffffff;
}

.sidebar-brand-sub {
    font-size: 0.72rem;
    color: var(--text-dim);
    font-weight: 500;
    margin-top: 1px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 9px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    position: relative;
}

.sidebar-nav-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.06);
    transform: translateX(2px);
}

.sidebar-nav-item.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(56, 189, 248, 0.04));
    border: 1px solid rgba(56, 189, 248, 0.35);
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.1);
}

.sidebar-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px var(--accent);
}

.sidebar-nav-icon {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    display: inline-block;
}

.sidebar-sub-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 3px 0 6px 0;
    padding-left: 12px;
    border-left: 2px solid rgba(56, 189, 248, 0.2);
    margin-left: 24px;
}

.sidebar-sub-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.sidebar-sub-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-sub-item.active {
    color: var(--accent);
    background: rgba(56, 189, 248, 0.12);
    font-weight: 600;
}

.sub-nav-tabs {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    gap: 4px;
}

.sub-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.sub-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.sub-tab-btn.active {
    color: #fff;
    background: var(--accent);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.25);
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.76rem;
    color: var(--text-dim);
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    border: 1px solid var(--border-light);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    display: inline-block;
    flex-shrink: 0;
    animation: pulse-dot 2.5s infinite;
}

@keyframes pulse-dot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.main-content-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ========================================================
   TOP ACTION BAR & SELECTORS
   ======================================================== */
.top-action-bar {
    background: rgba(13, 19, 31, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 14px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
}

.selector-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

select {
    background: #151e2e url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") no-repeat calc(100% - 12px) center;
    border: 1px solid var(--border);
    color: #fff;
    padding: 0.5rem 2.2rem 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

select:hover {
    border-color: var(--accent);
    background-color: #1a2538;
}

select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

select option {
    background: #111722;
    color: #fff;
}

/* ========================================================
   GLASSMORPHISM & CARDS
   ======================================================== */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.glass:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* ========================================================
   KPI & METRIC CARDS
   ======================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.kpi-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    border-radius: 12px;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--card-border-hover);
}

.logo-card {
    align-items: center;
    justify-content: center;
    display: flex;
    background: rgba(19, 28, 43, 0.5);
    padding: 1rem;
}

.company-logo-badge {
    width: 62px;
    height: 62px;
    border-radius: 14px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    flex-shrink: 0;
}

.company-logo-badge img, #company-logo {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.kpi-card h3 {
    font-size: 0.74rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    line-height: 1.15;
}

.kpi-label { 
    color: var(--text-dim); 
    font-size: 0.78rem; 
    font-weight: 500;
}

.kpi-change {
    font-size: 1.15rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.kpi-change.positive, .pos-val, .pos-cell { 
    color: var(--positive); 
}
.kpi-change.negative, .neg-val, .neg-cell { 
    color: var(--negative); 
}

/* ========================================================
   SEGMENTED CONTROLS & TIME FILTERS
   ======================================================== */
.time-filters {
    display: inline-flex;
    justify-content: center;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
    margin: 1.5rem auto;
}

.time-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 6px 14px;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.82rem;
    font-family: inherit;
    transition: all 0.15s ease;
}

.time-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.time-btn.active {
    background: var(--accent);
    color: #0b0f19;
    font-weight: 700;
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* ========================================================
   CHARTS & VISUALIZATION
   ======================================================== */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr 1fr;
    }
    .chart-card:first-child {
        grid-column: span 2;
    }
}

.chart-card {
    padding: 1.5rem;
    min-height: 380px;
    display: flex;
    flex-direction: column;
}

.chart-card h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.commodity-icons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.commodity-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.commodity-icon:hover {
    transform: scale(1.15);
    box-shadow: 0 0 12px var(--accent-glow);
    border-color: var(--accent);
}

.chart-unit {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.8rem;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 19, 31, 0.75);
    backdrop-filter: blur(4px);
    font-weight: 600;
    color: var(--accent);
    z-index: 10;
    border-radius: 12px;
}

/* ========================================================
   INFO & NEWS CARDS
   ======================================================== */
.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .info-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.info-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    max-height: 600px;
}

.info-card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #fff;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.markdown-content {
    overflow-y: auto;
    padding-right: 0.8rem;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.65;
}

.markdown-content h3, .markdown-content h4 {
    color: var(--text-primary);
    margin-top: 1rem;
    margin-bottom: 0.4rem;
    font-size: 1rem;
}

.markdown-content p {
    margin-bottom: 0.8rem;
}

.markdown-content strong {
    color: #fff;
}

/* News List */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    padding-right: 0.8rem;
}

.news-item {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    border: 1px solid var(--border-light);
    transition: all 0.18s ease;
}

.news-item:hover {
    border-color: var(--card-border-hover);
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(3px);
}

.news-meta {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.news-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.news-title a:hover {
    color: var(--accent);
}

.news-summary {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.5;
}

/* ========================================================
   BUTTONS & ACTIONS
   ======================================================== */
.nav-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.15);
}

.update-btn {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
}

.update-btn:hover {
    background: rgba(56, 189, 248, 0.22);
    color: #fff;
    border-color: #38bdf8;
    box-shadow: 0 0 14px var(--accent-glow);
}

.update-btn.loading {
    opacity: 0.85;
    cursor: wait;
    border-color: #38bdf8;
    animation: pulseGlow 1.5s infinite;
}

.update-btn.loading .btn-icon {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(56, 189, 248, 0); }
    100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

/* ========================================================
   TABLES & FINANCIAL SHEETS
   ======================================================== */
.financial-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: right;
    color: var(--text-primary);
}

.financial-table th, .financial-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
}

.financial-table th:first-child, .financial-table td:first-child {
    text-align: left;
}

.table-header-row {
    background: rgba(30, 41, 59, 0.8);
    color: #fff;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-group-row {
    background: rgba(56, 189, 248, 0.08);
    color: var(--accent);
    font-weight: 700;
}

.table-data-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

.table-data-row:hover {
    background: rgba(56, 189, 248, 0.04);
}

.financial-table .report-guidance-row td {
    padding: 0.65rem 1rem 0.85rem;
    background: rgba(56, 189, 248, 0.035);
    text-align: left;
}

.report-guidance-box {
    border-left: 3px solid var(--accent);
    border-radius: 0 6px 6px 0;
    padding: 0.75rem 1rem;
    background: rgba(56, 189, 248, 0.08);
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
    font-weight: 400;
    white-space: normal;
}

.report-guidance-box strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--accent);
    font-size: 0.85rem;
}

.report-guidance-box p {
    margin: 0.35rem 0 0;
}

/* Datarapportering: vis hierarkiet i «Annen informasjon» som i rapporteringsarket. */
.financial-table .report-parent-row td {
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.28);
}

.financial-table .report-parent-label {
    font-weight: 700 !important;
}

.financial-table .report-child-label {
    padding-left: 2rem !important;
    font-weight: 450 !important;
    color: var(--text-secondary);
}

.financial-table .report-section-end td {
    border-bottom: 1px solid rgba(148, 163, 184, 0.42) !important;
}

.overall-goals-section {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-radius: 12px;
}

.overall-goals-heading-row {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1rem;
}

.overall-goals-heading-row h3 { margin: 0; color: var(--accent); font-size: 1.1rem; }
.overall-goals-heading-row p { margin: 0.35rem 0 0; color: var(--text-dim); font-size: 0.85rem; }
.overall-goals-heading-row label { color: var(--text-secondary); font-size: 0.85rem; }
.overall-goals-heading-row select { display: block; margin-top: 0.3rem; }

.overall-goals-table-wrap { overflow-x: auto; }
.overall-goals-table { width: 100%; min-width: 780px; border-collapse: collapse; }
.overall-goals-table th {
    padding: 0.7rem;
    background: #07565e;
    color: #fff;
    text-align: left;
    font-size: 0.85rem;
}
.overall-goals-table td { padding: 0.55rem; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.overall-goals-table tr:nth-child(even) td { background: rgba(255,255,255,0.025); }
.overall-goals-table textarea,
.overall-goals-table input,
.overall-goals-table select,
.overall-goals-heading-row select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #0b1220;
    color: var(--text-primary);
    font: inherit;
}
.overall-goals-table textarea { min-width: 125px; resize: vertical; }
.overall-goals-table :disabled { opacity: 0.8; cursor: default; }
.overall-goals-table details { margin-top: 0.35rem; font-size: 0.78rem; color: var(--text-dim); }
.overall-goals-table details textarea { margin-top: 0.3rem; }
.overall-goals-actions { min-width: 160px; }
.overall-goals-actions button { margin: 0.35rem 0.35rem 0 0; }
.overall-goals-add { margin-top: 1rem; }
.overall-goals-empty { color: var(--text-dim); font-size: 0.9rem; }

.sustainability-section { margin-top: 1.5rem; padding: 1.5rem; border-radius: 12px; }
.sustainability-heading-row {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1rem;
}
.sustainability-heading-row h3 { margin: 0; color: var(--accent); font-size: 1.1rem; }
.sustainability-heading-row p,
.sustainability-guidance,
.sustainability-climate-goal p { color: var(--text-dim); font-size: 0.85rem; line-height: 1.5; }
.sustainability-heading-row label { color: var(--text-secondary); font-size: 0.85rem; }
.sustainability-heading-row select,
.sustainability-field select,
.sustainability-field textarea,
.sustainability-save input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #0b1220;
    color: var(--text-primary);
    font: inherit;
}
.sustainability-field select { cursor: pointer; padding-right: 2rem; }
.sustainability-heading-row select { display: block; margin-top: 0.3rem; }
.sustainability-subsection { border-top: 1px solid var(--border-light); padding: 1rem 0 0.4rem; }
.sustainability-subsection h4 { margin: 0; color: #fff; font-size: 1rem; }
.sustainability-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 0.8rem; }
.sustainability-field { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.86rem; color: var(--text-secondary); }
.sustainability-field textarea { min-height: 70px; resize: vertical; }
.sustainability-field :disabled { opacity: 0.8; cursor: default; }
.sustainability-climate-goal { padding: 0.9rem; margin: 0.8rem 0; border: 1px solid var(--border-light); border-radius: 8px; }
.sustainability-climate-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.sustainability-climate-goal #desc-text-klimamal { white-space: pre-wrap; color: var(--text-primary); }
.sustainability-save { display: flex; align-items: end; gap: 0.8rem; flex-wrap: wrap; padding-top: 1rem; }
.sustainability-save label { flex: 1; min-width: 240px; color: var(--text-secondary); font-size: 0.85rem; }
.sustainability-save input { display: block; margin-top: 0.35rem; }

@media (max-width: 700px) {
    .overall-goals-heading-row { align-items: stretch; flex-direction: column; }
    .overall-goals-heading-row label { max-width: 140px; }
    .sustainability-heading-row { align-items: stretch; flex-direction: column; }
    .sustainability-heading-row label { max-width: 160px; }
}

.editable-cell {
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 4px;
}

.editable-cell:hover {
    background: rgba(56, 189, 248, 0.2) !important;
    color: #fff;
    box-shadow: inset 0 0 0 1px var(--accent);
}

/* ========================================================
   MODALS & POPUPS
   ======================================================== */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: #111722;
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: 14px;
    width: 90%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    margin-bottom: 0.5rem;
    color: #fff;
    font-size: 1.2rem;
}

.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(255, 255, 255, 0.06);
}

/* ========================================================
   PIPELINE STATUS BANNER
   ======================================================== */
.pipeline-banner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.pipeline-banner.running {
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #bae6fd;
}

.pipeline-banner.success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #86efac;
}

.pipeline-banner.error {
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fca5a5;
}

.pipeline-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(56, 189, 248, 0.2);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.pipeline-info strong {
    font-size: 0.92rem;
    color: #fff;
}

.pipeline-info span {
    font-size: 0.82rem;
    color: var(--text-dim);
}

/* ========================================================
   RESPONSIVE BREAKPOINTS
   ======================================================== */
@media (max-width: 900px) {
    .app-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        position: relative;
        padding: 16px 20px;
        box-shadow: none;
    }
    .sidebar-brand {
        margin-bottom: 14px;
        padding-bottom: 12px;
    }
    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }
    .sidebar-nav-item {
        padding: 8px 12px;
        font-size: 0.84rem;
    }
    .sidebar-footer {
        display: none;
    }
    .top-action-bar {
        padding: 12px 16px;
    }
    main {
        padding: 0 16px;
        margin: 1.5rem auto;
    }
}


/* ==========================================================================
   AUTHENTICATION VIEW & MODAL
   ========================================================================== */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
  background-image: radial-gradient(circle at 50% 30%, #152238 0%, #0b0f19 75%);
}

.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-align: center;
}

.auth-box h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.auth-box p {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.5;
}

.auth-box .form-group {
  text-align: left;
  margin-bottom: 18px;
}

.auth-box .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.auth-box .form-control {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.auth-box .form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.auth-box .error-msg {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fb7185;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: left;
}

.auth-box .auth-btn {
  width: 100%;
  background: var(--accent);
  color: #0b0f19;
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  margin-top: 8px;
  transition: filter 0.2s, transform 0.1s;
}

.auth-box .auth-btn:hover {
  filter: brightness(1.1);
}

.auth-box .auth-btn:active {
  transform: scale(0.98);
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.logout-btn:hover {
  color: var(--neg);
  border-color: var(--neg);
}

/* =========================================================
   ADMIN USER MANAGEMENT UI
   ========================================================= */
.admin-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.admin-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-primary {
  background: var(--accent);
  color: #0b0f19;
  font-weight: 600;
  font-size: 13px;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
}

.stat-box .stat-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-box .stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.admin-table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.admin-table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.role-badge.admin {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.role-badge.company {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.comp-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  margin: 2px 4px 2px 0;
}

.comp-pill .perm-edit {
  color: #4ade80;
  font-weight: 600;
}

.comp-pill .perm-view {
  color: #94a3b8;
}

.table-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: #94a3b8;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-icon.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-dialog {
  background: #131b2e;
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 540px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: #0d121f;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: #fff;
  font-size: 13px;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
}

.company-access-list {
  background: #0d121f;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.company-access-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
}

.company-access-item label {
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e2e8f0;
  font-size: 13px;
}

.company-access-item select {
  background: #1e293b;
  border: 1px solid var(--border);
  color: #fff;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
}


/* Standardized Sidebar User & Logout Box */
.sidebar-user-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.sidebar-user-icon {
    font-size: 0.95rem;
    color: var(--accent);
    flex-shrink: 0;
}

.sidebar-user-email {
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
}

.sidebar-logout-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    width: 100%;
}

.sidebar-logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ffffff;
    transform: translateY(-1px);
}

/* ========================================================
   FINANSIELT REGNSKAP & KVARTALSVISNING
   ======================================================== */

.main-tabs-nav {
    display: flex;
    gap: 0.5rem;
    padding: 6px;
    background: rgba(19, 28, 43, 0.6);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.main-tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.main-tab-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.main-tab-btn.active {
    background: var(--accent);
    color: #0b0f19;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
}

.financial-report-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    font-family: var(--font);
}

.report-table-scroll,
.peer-table-scroll {
    max-height: min(70vh, 680px);
    overflow: auto;
    scrollbar-gutter: stable;
}

.peer-table-scroll .financial-table {
    border-collapse: separate !important;
    border-spacing: 0;
}

.peer-table-scroll .financial-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #172337;
    box-shadow: 0 1px 0 rgba(255,255,255,.12);
}

.peer-table-scroll .financial-table th:first-child,
.peer-table-scroll .financial-table td:first-child,
.report-table-scroll .financial-report-table th:first-child,
.report-table-scroll .financial-report-table td:first-child {
    position: sticky;
    left: 0;
    background: #131c2b;
    z-index: 2;
}

.peer-table-scroll .financial-table thead th:first-child,
.report-table-scroll .financial-report-table thead th:first-child {
    z-index: 4;
    background: #172337;
}

.peer-definition { margin-top: .7rem; max-width: 800px; color: #afc7dd; font-size: .83rem; }
.peer-definition summary { color: #7cc9f5; cursor: pointer; width: fit-content; }
.peer-definition p { margin: .45rem 0 0; line-height: 1.5; }
.peer-sample-count { display: block; color: #94a3b8; font-size: .72rem; font-weight: 400; }
.portfolio-coverage { color: #9fb3c9; font-size: .8rem; line-height: 1.45; margin: .55rem 0 0; }

.financial-report-table thead th {
    background: rgba(15, 23, 42, 0.95);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.financial-report-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-feature-settings: "tnum" 1;
}

.report-category-header-row td {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding-top: 14px;
    padding-bottom: 8px;
}

.report-detail-row:hover {
    background: rgba(255, 255, 255, 0.02);
}
.statement-row-trigger { border: 0; background: transparent; color: inherit; font: inherit; font-weight: inherit; text-align: left; cursor: pointer; padding: 2px 0; }
.statement-row-trigger:hover, .statement-row-trigger:focus-visible { color: var(--accent); text-decoration: underline; }
.statement-row-panel[hidden] { display: none; }
.statement-row-panel { position: fixed; inset: 0; z-index: 1000; }
.statement-row-backdrop { position: absolute; inset: 0; background: rgba(2, 6, 23, .7); }
.statement-row-aside { position: absolute; right: 0; top: 0; bottom: 0; width: min(680px, 100%); box-sizing: border-box; padding: 32px; background: #111c2c; box-shadow: -12px 0 32px rgba(0,0,0,.35); overflow-y: auto; }
.statement-row-aside h2 { padding-right: 40px; color: #fff; }
.statement-row-aside p { color: #a9bed4; line-height: 1.5; }
.statement-row-close { position: absolute; top: 20px; right: 24px; border: 1px solid var(--border); border-radius: 8px; background: #1e293b; color: #fff; font-size: 26px; cursor: pointer; width: 40px; height: 40px; }
.statement-row-chart-wrap { height: 360px; }
#commodity-index-periods button { border: 1px solid #34465d; border-radius: 7px; background: #1b293d; color: #b9c9db; padding: 6px 11px; font: inherit; font-size: .8rem; cursor: pointer; }
#commodity-index-periods button.active, #commodity-index-periods button:hover { border-color: #38bdf8; background: #12334b; color: #e7f7ff; }

.report-subtotal-row td {
    font-size: 0.92rem;
}

.report-highlight-row td {
    border-top: 1px solid rgba(56, 189, 248, 0.2);
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

/* ========================================================
   GRAF-EKSPORT TIL EXCEL KNAPPER
   ======================================================== */
.btn-chart-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary, #94a3b8);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.2;
}

.btn-chart-export:hover {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    transform: translateY(-1px);
}

.btn-chart-export svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    flex-shrink: 0;
}



/* ========================================================
   SELSKAPSPORTAL (PORTAL.HTML) DEDIKERT GRENSESNITT
   ======================================================== */
.portal-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-color, #0b0f19);
    background-image: var(--bg-gradient, radial-gradient(circle at 80% 10%, #152238 0%, #0b0f19 70%));
    color: var(--text-primary, #f1f5f9);
    font-family: var(--font, 'Inter', system-ui, sans-serif);
}

.portal-header {
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    position: sticky;
    top: 0;
    z-index: 100;
}

.portal-header-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0.85rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.portal-brand-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.portal-brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}

.portal-brand-sub {
    font-size: 0.76rem;
    color: var(--text-dim, #64748b);
    display: block;
    margin-top: 1px;
}

.portal-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.portal-selector {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.portal-select-label {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.88rem;
    font-weight: 500;
}

.portal-select {
    padding: 7px 12px;
    border-radius: 8px;
    background: #0f172a;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.portal-select:focus {
    border-color: var(--accent, #38bdf8);
}

.portal-btn-ppt {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent, #38bdf8);
    color: #0b0f19;
    border-color: var(--accent, #38bdf8);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.portal-btn-ppt:hover {
    background: #7dd3fc;
    border-color: #7dd3fc;
}

.portal-user-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
}

.portal-user-email {
    color: var(--text-primary, #f1f5f9);
    font-weight: 500;
}

.portal-logout-btn {
    background: transparent;
    border: none;
    color: var(--text-dim, #64748b);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.portal-logout-btn:hover {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.15);
}

.portal-nfd-link {
    color: var(--accent, #38bdf8);
    font-size: 0.82rem;
    text-decoration: none;
    padding: 6px 10px;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    border-radius: 6px;
    background: rgba(56, 189, 248, 0.06);
    transition: all 0.2s ease;
}

.portal-nfd-link:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--accent, #38bdf8);
}

.portal-main {
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

.portal-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.portal-heading {
    font-size: 1.45rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

@media (max-width: 800px) {
    .portal-header-inner {
        padding: 0.8rem 1rem;
    }
    .portal-main {
        padding: 1rem;
    }
    .portal-top-bar {
        flex-direction: column;
        align-items: stretch;
    }
}


/* ========================================================
   SELSKAPSBILDER & ILLUSTRASJONER STYLING
   ======================================================== */
.company-images-section {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-radius: 12px;
}

.company-image-guidance { max-width: 920px; margin-top: .65rem; color: var(--text-dim, #aab6c9); font-size: .86rem; line-height: 1.6; }
.company-image-guidance p { margin: .4rem 0; }
.company-image-guidance strong { color: var(--text-primary, #f1f5f9); }
.company-image-guidance a { color: var(--accent, #7cc5f5); text-decoration: underline; }
.company-image-credit-label { display: block; margin-top: 9px; color: var(--text-primary, #f1f5f9); font-size: .82rem; }
#company-image-credit-input, .company-image-details-editor input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--border, #35445a); border-radius: 6px; background: #0d1421; color: #f8fafc; font: inherit; }
.company-image-credit { font-size: .78rem; color: #aab6c9; line-height: 1.35; overflow-wrap: anywhere; }
.financial-definition-button { display: inline-grid; place-items: center; width: 19px; height: 19px; margin-left: 8px; padding: 0; border: 1px solid var(--accent); border-radius: 50%; background: transparent; color: var(--accent); font-family: inherit; font-size: 12px; font-weight: 700; line-height: 1; cursor: pointer; vertical-align: middle; }
.financial-definition-button::before { content: 'i'; }
.financial-definition-button:hover, .financial-definition-button:focus-visible { background: rgba(56, 189, 248, .15); outline-offset: 2px; }
.financial-definition-text { display: block; max-width: 62ch; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; background: #18283a; color: var(--text); font-size: .83rem; font-weight: 400; line-height: 1.5; white-space: normal; }
.financial-definition-text[hidden] { display: none; }
.calculated-reporting-row { color: #a8b4c2; }
.calculated-reporting-row > td:first-child { color: #a8b4c2; }
.calculated-reporting-value { color: #a8b4c2; font-variant-numeric: tabular-nums; font-weight: 600; }
.calculated-reporting-badge { display: inline-block; margin-left: 9px; color: #94a3b8; font-size: .72rem; font-weight: 500; letter-spacing: .01em; }
.report-table output.calculated-reporting-value { display: block; min-height: 1.5em; text-align: right; }
.company-board-guidance { margin: 0 0 18px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 9px; background: rgba(56, 189, 248, .055); color: var(--text-dim); font-size: .9rem; line-height: 1.6; }
.company-board-guidance p { margin: 0; }
.company-board-guidance p:first-child { color: var(--text); font-weight: 600; }
.company-board-guidance ul { margin: 8px 0 14px; padding-left: 1.35rem; }
.company-board-guidance li + li { margin-top: 3px; }
.company-board-rows { display: grid; gap: 12px; }
.company-board-row { display: grid; grid-template-columns: minmax(170px, 1.6fr) minmax(95px, .7fr) minmax(140px, 1fr) repeat(3, minmax(120px, 1fr)) auto; gap: 10px; align-items: end; padding: 14px; background: rgba(15,23,42,.45); border: 1px solid var(--border); border-radius: 9px; }
.company-board-row > label, .company-board-radios { display: grid; gap: 6px; color: var(--text-dim); font-size: .8rem; min-width: 0; }
.company-board-row input:not([type="radio"]) { width: 100%; min-width: 0; box-sizing: border-box; padding: 8px; border: 1px solid var(--border); border-radius: 6px; background: #0d1421; color: #f8fafc; font: inherit; }
.company-board-radios { border: 0; margin: 0; padding: 0; }
.company-board-radios legend { padding: 0; margin-bottom: 6px; }
.company-board-radios label { display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
.company-board-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.company-board-actions button, .company-board-remove { padding: 7px 11px; border: 1px solid var(--border); border-radius: 6px; background: #17253a; color: #d9edff; cursor: pointer; }
.company-board-remove { color: #f4b5b5; }
.company-board-empty, .company-board-legacy { color: var(--text-dim); font-size: .85rem; }
.company-board-legacy { margin-top: 14px; }
.company-board-legacy p { white-space: pre-wrap; }
.company-board-row .company-board-personal[hidden] { display: none; }
@media (max-width: 1300px) { .company-board-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .company-board-row { grid-template-columns: 1fr; } }
.company-primary-image { margin-top: 1.1rem; }
.company-primary-image:empty { display: none; }
.company-primary-image-content { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--accent, #7cc5f5); border-radius: 10px; background: rgba(56, 189, 248, .07); }
.company-primary-image-content img { width: 160px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.company-primary-image-content div { display: grid; gap: 4px; min-width: 0; }
.company-primary-image-content strong { color: #f1f5f9; }
.company-primary-image-content span, .company-primary-image-content small { color: #aab6c9; overflow-wrap: anywhere; }
.company-image-primary-btn, .company-image-details-editor button { background: #203b50; border: 1px solid #47799b; border-radius: 6px; color: #d8efff; padding: 7px 9px; cursor: pointer; font: inherit; font-size: .78rem; text-align: left; }
.company-image-primary-btn:hover, .company-image-details-editor button:hover { background: #2c526d; }
.company-image-primary-label { color: #8fdac0; font-size: .77rem; font-weight: 700; }
.company-image-details-editor { border-top: 1px solid var(--border, #35445a); padding-top: 7px; font-size: .78rem; }
.company-image-details-editor summary { color: #8acbfa; cursor: pointer; }
.company-image-details-editor label { display: block; margin: 8px 0 4px; color: #aab6c9; }
.company-image-details-editor button { margin-top: 9px; }
@media (max-width: 580px) { .company-primary-image-content { align-items: flex-start; flex-direction: column; } .company-primary-image-content img { width: 100%; } }

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

.company-image-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.company-image-card:hover {
    border-color: var(--accent, #38bdf8);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.company-image-thumb-wrap {
    width: 100%;
    height: 160px;
    background: #070b12;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.company-image-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.company-image-thumb-wrap:hover .company-image-thumb {
    transform: scale(1.04);
}

.company-image-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.company-image-caption {
    font-size: 0.88rem;
    color: var(--text-primary, #f1f5f9);
    font-weight: 500;
    line-height: 1.35;
    word-break: break-word;
}

.company-image-filename {
    font-size: 0.76rem;
    color: var(--text-dim, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.company-image-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
    color: var(--text-dim, #64748b);
}

.company-image-del-btn {
    background: transparent;
    border: none;
    color: #f87171;
    font-size: 0.78rem;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

.company-image-del-btn:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
}

.company-image-upload-box {
    border: 2px dashed rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.03);
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.company-image-upload-box:hover,
.company-image-upload-box.dragover {
    border-color: var(--accent, #38bdf8);
    background: rgba(56, 189, 248, 0.08);
    transform: scale(1.005);
}

.company-image-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: pointer;
}

.company-image-lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
}

.company-image-lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.company-image-lightbox-caption {
    margin-top: 12px;
    color: #f1f5f9;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
}


/* ==========================================
   SELSKAPSLOGO SEKSJON
   ========================================== */

.company-logo-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border-radius: 12px;
}

.company-logo-container {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 860px) {
    .company-logo-container {
        grid-template-columns: 1fr;
    }
}

.company-logo-preview-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.company-logo-stage {
    width: 100%;
    min-height: 140px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.2s ease;
    overflow: hidden;
}

.company-logo-stage.bg-checker {
    background-color: #1e293b;
    background-image: 
        linear-gradient(45deg, #0f172a 25%, transparent 25%), 
        linear-gradient(-45deg, #0f172a 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #0f172a 75%), 
        linear-gradient(-45deg, transparent 75%, #0f172a 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.company-logo-stage.bg-dark {
    background: #090d16;
}

.company-logo-stage.bg-light {
    background: #ffffff;
}

.company-logo-img {
    max-width: 100%;
    max-height: 110px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}

.company-logo-bg-toggles {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    margin-bottom: 8px;
}

.company-logo-bg-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-dim, #94a3b8);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s;
}

.company-logo-bg-btn.active,
.company-logo-bg-btn:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: rgba(56, 189, 248, 0.4);
    color: #fff;
}

.company-logo-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 14px;
    border-radius: 6px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: var(--accent, #38bdf8);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.company-logo-download-btn:hover {
    background: rgba(56, 189, 248, 0.22);
    color: #fff;
}

.company-logo-upload-box {
    border: 2px dashed rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.03);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.company-logo-upload-box:hover,
.company-logo-upload-box.dragover {
    border-color: var(--accent, #38bdf8);
    background: rgba(56, 189, 248, 0.08);
}

/* The reporting view is shared by the internal dashboard and the company portal. */
.reporting-workspace { min-width: 0; }
.reporting-workspace-tabs { flex-wrap: wrap; }
.reporting-workspace-panel { min-width: 0; padding: 1.5rem; border-radius: 12px; }
.reporting-workspace-intro { margin-bottom: 1.25rem; }
.reporting-workspace-intro h3 { color: #fff; font-size: 1.1rem; font-weight: 650; margin: 0 0 4px; }
.reporting-workspace-intro p { color: var(--text-dim); font-size: 0.85rem; line-height: 1.55; margin: 0; }
.reporting-workspace-table-wrap { overflow-x: auto; }
.reporting-workspace .financial-table { width: 100%; border-collapse: collapse; }
.reporting-workspace .financial-table th, .reporting-workspace .financial-table td { font-size: 0.9rem; }
.reporting-workspace .info-card,
.report-media-slot .info-card { max-height: none; min-width: 0; }
.reporting-workspace .company-logo-container,
.report-media-slot .company-logo-container { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); }
.reporting-workspace .company-logo-preview-card,
.reporting-workspace .company-logo-container > div,
.reporting-workspace .company-images-section,
.report-media-slot .company-logo-preview-card,
.report-media-slot .company-logo-container > div { min-width: 0; }
.reporting-workspace .overall-goals-table th { background: #1b293b; color: #e4eef8; border-bottom: 1px solid #40516a; }
.reporting-workspace .overall-goals-heading-row h3,
.reporting-workspace .sustainability-heading-row h3 { color: var(--accent); }

@media (max-width: 860px) {
    .reporting-workspace .company-logo-container,
    .report-media-slot .company-logo-container { grid-template-columns: minmax(0, 1fr); }
}
