:root {
    --corp-primary: #001020;
    --corp-border: #e0e0e0;
    --corp-text-gray: #666;
    --corp-bg-light: #f8f9fa;
    --corp-success: #28a745;
    --corp-info: #17a2b8;
    --corp-warning: #ffc107;
    --corp-danger: #dc3545;
    --font-sans: "Atkinson Hyperlegible", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
    --font-display: "Bebas Neue", sans-serif;
    --header-height: 64px;
    --sidebar-width: 280px;
    --content-max-width: 1600px;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--corp-primary);
    background-color: #fff;
}

.section-group {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.section-item {
    margin-bottom: 20px;
}

    .section-item[data-level="2"] .section-group {
        margin-top: 1rem;
    }

    .section-item[data-level="3"] {
        transition: border-color 0.2s ease, padding-left 0.2s ease;
    }

        .section-item[data-level="3"]:hover {
            border-left-color: var(--corp-primary);
            padding-left: 1.75rem;
        }

.section-group > .section-item:not([data-level]) + .section-item:not([data-level]) {
    border-top: 1px solid #e5e5e5;
    padding-top: 20px;
}

.section-header {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 0 0 20px 0;
    padding: 0;
    color: #333;
    line-height: 1.4;
    display: block;
    text-decoration: none;
    background: transparent;
    border-radius: 0;
}

.section-content {
    margin-top: 0;
}

.section-item[data-level="2"],
.section-item--nested {
    margin-left: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    margin-bottom: 0.25rem;
    border: none;
    border-top: 1px solid #e5e5e5;
    padding-top: 0.25rem;
}

    .section-item[data-level="2"]:first-child {
        border-top: none;
        padding-top: 0;
    }

.section-header[data-level="2"],
.section-header--nested {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--corp-primary);
    margin-bottom: 0.25rem;
    padding-bottom: 0;
    border-bottom: none;
}

.section-item[data-level="3"],
.section-item--double-nested {
    margin-left: 0;
    padding: 0;
    padding-left: 1.5rem;
    background: transparent;
    border-radius: 0;
    margin-bottom: 0.75rem;
    border: none;
    border-left: 2px solid #f0f0f0;
    box-shadow: none;
}

.section-header[data-level="3"],
.section-header--double-nested {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #444;
    margin-bottom: 0.375rem;
    position: relative;
    padding-left: 0;
}

    .section-header[data-level="3"]::before,
    .section-header--double-nested::before {
        display: none;
    }

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--corp-border);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 100%;
}

.logo {
    height: 40px;
    width: auto;
    display: block;
}

.site-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--corp-primary);
    line-height: 1;
}

.property-badge {
    background: var(--corp-bg-light);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--corp-border);
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
}

.print-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--corp-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
    line-height: 1;
    height: 40px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 16, 32, 0.1);
}

    .print-button::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s;
    }

    .print-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 16, 32, 0.2);
        background: #001830;
    }

        .print-button:hover::after {
            width: 300px;
            height: 300px;
        }

    .print-button:active {
        transform: translateY(0);
        box-shadow: 0 1px 3px rgba(0, 16, 32, 0.2);
    }

    .print-button:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(0, 16, 32, 0.1), 0 4px 12px rgba(0, 16, 32, 0.2);
    }

    .print-button span,
    .print-button i {
        position: relative;
        z-index: 1;
    }

    .print-button svg {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 16px;
        height: 16px;
    }

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    height: 40px;
    width: 40px;
    align-items: center;
    justify-content: center;
}

    .mobile-menu-toggle svg {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

.smart-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--corp-bg-light);
    border-right: 1px solid var(--corp-border);
    overflow-y: auto;
    z-index: 900;
}

.sidebar-content {
    padding: 1.5rem;
}

.sidebar-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--corp-text-gray);
    margin: 0 0 1rem 0;
    font-weight: 600;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--corp-primary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: all 0.2s;
    position: relative;
}

    .nav-link:hover {
        background: rgba(0, 16, 32, 0.05);
    }

    .nav-link.active {
        background: rgba(0, 16, 32, 0.1);
        font-weight: 600;
    }

        .nav-link.active::before {
            content: "";
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 3px;
            height: 24px;
            background: var(--corp-primary);
            border-radius: 0 2px 2px 0;
        }

.generation-timestamp {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--corp-border);
    font-size: 0.75rem;
    color: var(--corp-text-gray);
}

.main-wrapper {
    margin-top: var(--header-height);
    margin-left: var(--sidebar-width);
    min-height: calc(100vh - var(--header-height));
    background: #fff;
}

.main-content {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 2rem;
}

.dashboard-section {
    margin-bottom: 3rem;
}

.property-hero {
    margin-bottom: 2rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.property-image-wrapper {
    position: relative;
    height: 400px;
    background: var(--corp-bg-light);
    transition: all 0.3s ease-in-out;
}

    .property-image-wrapper.map-container-expanded {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100vh;
        width: 100vw;
        z-index: 9999;
        margin: 0;
        border-radius: 0;
    }

.map-toggle-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--corp-primary);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

    .map-toggle-btn:hover {
        background: var(--corp-primary);
        color: white;
        transform: scale(1.05);
        box-shadow: var(--shadow-md);
    }

    .map-toggle-btn:active {
        transform: scale(0.95);
    }

    .map-toggle-btn svg {
        display: block;
        width: 20px;
        height: 20px;
    }

.map-container-expanded .property-overlay {
    max-width: 600px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.map-layer-controls {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 160px;
}

.layer-controls-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--corp-primary);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

    .layer-controls-header svg {
        width: 16px;
        height: 16px;
    }

.layer-control-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background-color 0.15s ease;
}

    .layer-control-item:last-child {
        border-bottom: none;
    }

    .layer-control-item:hover {
        background-color: rgba(0, 16, 32, 0.02);
    }


.layer-toggle-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.layer-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    width: 100%;
    margin: 0;
    user-select: none;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 10px;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.layer-toggle-checkbox:checked + .layer-toggle-label .toggle-switch {
    background: var(--corp-primary);
}

.layer-toggle-checkbox:checked + .layer-toggle-label .toggle-slider {
    transform: translateX(20px);
}

.layer-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--corp-text);
}

.layer-control-item[data-layer="rattigheter"] .layer-toggle-checkbox:checked + .layer-toggle-label .toggle-switch {
    background: #ef4444;
}

.layer-control-item[data-layer="bestammelser"] .layer-toggle-checkbox:checked + .layer-toggle-label .toggle-switch {
    background: #f97316;
}

.map-container-expanded .map-layer-controls {
    top: 1.5rem;
    left: 1.5rem;
}

@media (max-width: 768px) {
    .map-toggle-btn {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.4rem;
    }

        .map-toggle-btn svg {
            width: 18px;
            height: 18px;
        }

    .map-layer-controls {
        top: 3.5rem;
        left: 0.5rem;
        min-width: 140px;
    }

    .layer-controls-header {
        padding: 0.625rem 0.875rem;
        font-size: 0.75rem;
    }

    .layer-control-item {
        padding: 0.5rem 0.875rem;
    }

    .layer-name {
        font-size: 0.8rem;
    }

    .toggle-switch {
        width: 40px;
        height: 22px;
    }

    .toggle-slider {
        width: 18px;
        height: 18px;
    }

    .layer-toggle-checkbox:checked + .layer-toggle-label .toggle-slider {
        transform: translateX(18px);
    }

    .map-container-expanded .property-overlay {
        max-width: 100%;
        left: 0;
        transform: none;
        border-radius: 0;
    }

    .map-container-expanded .map-layer-controls {
        top: 3.5rem;
        left: 0.5rem;
    }
}

.property-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.property-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem;
    background: linear-gradient(to top, rgba(0, 16, 32, 0.9), transparent);
    color: white;
}

.property-title {
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
    font-family: var(--font-display);
    letter-spacing: 0.02em;
}

.property-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0.5rem 0 0 0;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    background: #fff;
    border: 1px solid var(--corp-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: all 0.3s;
}

    .metric-card:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
    }

    .metric-card.highlight {
        background: var(--corp-bg-light);
        border-color: var(--corp-primary);
    }

.metric-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 1rem;
    color: var(--corp-primary);
}

.metric-label {
    font-size: 0.875rem;
    color: var(--corp-text-gray);
    margin: 0;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0.25rem 0 0 0;
    color: var(--corp-primary);
}

.document-section {
    background: #fff;
    border: 1px solid var(--corp-border);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    overflow: clip;
}

    .document-section > .section-header {
        background: var(--corp-bg-light);
        padding: 1.5rem 2rem;
        border-bottom: 1px solid var(--corp-border);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

.section-header.sticky {
    position: -webkit-sticky;
    position: sticky;
    top: var(--header-height);
    z-index: 100;
    background: var(--corp-bg-light);
    margin: 0 -1px;
    width: calc(100% + 2px);
    border-radius: 0;
}

.document-section > .section-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--corp-primary);
    flex: 0 0 auto;
}

.document-section > .section-content {
    padding: 2rem;
}

.section-item .section-content {
    padding: 0.5rem 0 0 0;
    margin-top: 0;
}

@media screen and (max-width: 1024px) {
    .smart-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

        .smart-sidebar.active {
            transform: translateX(0);
        }

    .main-wrapper {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: inline-flex;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

.screen-only {
    display: block;
}


.custom-table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

    .custom-table th {
        padding: 0.75rem;
        text-align: left;
        font-weight: 600;
        color: #333;
        border-bottom: 2px solid #e5e5e5;
        background-color: #f8f8f8;
    }

    .custom-table td {
        padding: 0.75rem;
        vertical-align: top;
        border-bottom: 1px solid #e5e5e5;
    }

    .custom-table tbody tr:last-child td {
        border-bottom: none;
    }

    .custom-table tbody tr:hover {
        background-color: #fafafa;
    }

    .custom-table.table-divider td {
        border-bottom: 1px solid #e5e5e5;
    }

    .custom-table.table-divider tbody tr:last-child td {
        border-bottom: 1px solid #e5e5e5;
    }

    .custom-table td[colspan="2"] img {
        width: 100%;
        height: auto;
        max-width: 100%;
        max-height: 600px;
        display: block;
        object-fit: contain;
        margin: 0 auto;
        padding: 0;
        box-sizing: border-box;
    }

    .custom-table td[colspan="2"] {
        padding: 0.5rem;
        text-align: left;
        overflow: hidden;
    }

.section-content .custom-table.table-divider:has(img) {
    margin-bottom: 2rem;
}

/* Ortofoto styling */
.ortofoto-container {
    margin-bottom: 2.5rem;
}

    .ortofoto-container:last-child {
        margin-bottom: 0;
    }

.ortofoto-metadata {
    display: flex;
    gap: 2rem;
    padding: 1rem;
    background: var(--corp-bg-light);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid var(--corp-border);
}

.ortofoto-metadata-item {
    flex: 1;
    min-width: 0;
}

.ortofoto-metadata-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--corp-text-gray);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.ortofoto-metadata-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--corp-primary);
}

.ortofoto-image-wrapper {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--corp-border);
    margin-bottom: 1rem;
}

    .ortofoto-image-wrapper img {
        width: 100%;
        height: auto;
        display: block;
        margin: 0;
    }

.ortofoto-download-section {
    margin-top: 1.5rem;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border: none;
}

.download-info {
    margin-bottom: 1rem;
}

.download-badge {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--corp-primary);
    font-size: 1rem;
}

    .download-badge span {
        display: inline;
    }

.download-icon {
    display: none;
}

.download-description {
    margin: 0;
    color: var(--corp-text);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.file-info {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--corp-text-gray);
    font-weight: 500;
}

.btn-download-hires {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1.75rem;
    background: var(--corp-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 47, 75, 0.1);
}

    .btn-download-hires:hover {
        background: #001830;
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0, 47, 75, 0.15);
        color: white;
        text-decoration: none;
    }

    .btn-download-hires:active {
        transform: translateY(0);
        box-shadow: 0 2px 4px rgba(0, 47, 75, 0.1);
    }

.btn-icon {
    flex-shrink: 0;
}

.screen-only {
    display: block;
}


.custom-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

    .custom-list li {
        padding: 0.25rem 0;
    }

    .custom-list.list-striped li {
        padding: 0.5rem;
        border-bottom: 1px solid #e5e5e5;
    }

        .custom-list.list-striped li:nth-child(even) {
            background-color: #f8f8f8;
        }

        .custom-list.list-striped li:last-child {
            border-bottom: none;
        }

.uk-table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

    .uk-table th {
        padding: 0.75rem;
        text-align: left;
        font-weight: 600;
        color: #333;
        border-bottom: 2px solid #e5e5e5;
        background-color: #f8f8f8;
    }

/* Custom Tooltip Styles */
.tooltip-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    color: #666;
    cursor: help;
    position: relative;
    margin-left: 4px;
    vertical-align: middle;
    font-family: Arial, sans-serif;
}

    .tooltip-icon:hover {
        background: #e8e8e8;
        border-color: #ccc;
        color: #333;
    }

    .tooltip-icon::before {
        content: attr(data-tooltip);
        position: fixed;
        top: var(--tooltip-top, auto);
        left: var(--tooltip-left, 50%);
        transform: translateX(-50%);
        background: #222;
        color: white;
        padding: 8px 12px;
        border-radius: 4px;
        font-size: 12px;
        font-weight: normal;
        line-height: 1.5;
        white-space: normal;
        word-wrap: break-word;
        max-width: 350px;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.2s, visibility 0.2s;
        z-index: 10000;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .tooltip-icon::after {
        content: "";
        position: fixed;
        top: calc(var(--tooltip-top, auto) + var(--tooltip-height, 30px) - 5px);
        left: var(--tooltip-left, 50%);
        transform: translateX(-50%);
        border: 5px solid transparent;
        border-top-color: #222;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.2s, visibility 0.2s;
        z-index: 10000;
    }

    .tooltip-icon.tooltip-bottom::after {
        top: calc(var(--tooltip-top, auto) - 10px);
        border-top-color: transparent;
        border-bottom-color: #222;
    }

    .tooltip-icon:hover::before,
    .tooltip-icon:hover::after {
        opacity: 1;
        visibility: visible;
    }

    .tooltip-icon.tooltip-top-left::before {
        left: auto;
        right: -10px;
        transform: none;
    }

    .tooltip-icon.tooltip-top-left::after {
        left: auto;
        right: 5px;
        transform: none;
    }

    .tooltip-icon.tooltip-top-right::before {
        left: -10px;
        transform: none;
    }

    .tooltip-icon.tooltip-top-right::after {
        left: 5px;
        transform: none;
    }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

    .section-header h2 {
        margin: 0;
    }

    .section-header .source-attribution {
        display: block;
        margin-top: 0;
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
        font-size: 0.75rem;
        color: #6b7280;
        margin-left: auto;
    }

.source-label {
    font-weight: 500;
    color: #6b7280;
    margin-right: 0.25rem;
}

.source-timestamp {
    font-weight: 600;
    color: #374151;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin-right: 0.5rem;
}

.source-divider {
    color: #d1d5db;
    margin: 0 0.5rem;
}

.source-text {
    color: #6b7280;
}

@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

        .section-header .source-attribution {
            margin-left: 0;
            margin-top: 0.5rem;
            font-size: 0.7rem;
        }
}


.mobile-notice {
    display: none;
}

@media (max-width: 768px) {
    .main-wrapper {
        margin-left: 0;
    }

    .main-content {
        padding: 0.5rem;
        max-width: 100%;
    }

    .document-section {
        border-radius: 0.5rem;
        margin-bottom: 0.75rem;
    }

        .document-section > .section-header {
            padding: 0.75rem;
        }

        .document-section > .section-content {
            padding: 0.75rem;
        }

    .property-hero {
        margin-bottom: 0.75rem;
        border-radius: 0.5rem;
    }

    .metrics-grid {
        gap: 0.5rem;
    }

    .metric-card {
        padding: 0.75rem;
    }

    .mobile-notice {
        display: block;
        background: #f0f4f8;
        border: 1px solid #d1d9e0;
        border-radius: 8px;
        padding: 12px;
        margin-bottom: 0.75rem;
    }

    .mobile-notice-content {
        display: flex;
        align-items: center;
        gap: 12px;
        color: #4a5568;
        font-size: 0.875rem;
        line-height: 1.4;
    }

        .mobile-notice-content svg {
            flex-shrink: 0;
            color: #718096;
        }

        .mobile-notice-content p {
            margin: 0;
        }

    .smart-sidebar {
        display: none;
    }

    .mobile-menu-toggle {
        display: none !important;
    }

    .print-button {
        display: none !important;
    }

    .tooltip-icon {
        display: none !important;
    }

    .custom-table {
        font-size: 0.875rem;
        line-height: 1.5;
    }

        .custom-table th {
            padding: 0.5rem;
            font-size: 0.8125rem;
            background-color: #f8f9fa;
        }

        .custom-table td {
            padding: 0.625rem;
            vertical-align: top;
        }

            .custom-table td:first-child {
                font-weight: 600;
                background-color: #f8f9fa;
                min-width: 140px;
                font-size: 0.8125rem;
                color: #2d3748;
            }

        .custom-table .custom-list {
            padding-left: 1rem;
            margin: 0;
        }

            .custom-table .custom-list li {
                font-size: 0.8125rem;
                padding: 0.25rem 0;
            }

        .custom-table .custom-table {
            margin-top: 0.5rem;
            font-size: 0.8125rem;
        }

            .custom-table .custom-table td {
                padding: 0.375rem;
                font-size: 0.75rem;
            }

        .custom-table a {
            word-break: break-word;
            font-size: 0.8125rem;
        }


    .section-item[data-level="2"] h3,
    .section-header[data-level="2"] {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .section-item[data-level="3"] .section-header {
        font-size: 0.875rem;
    }

    .section-content {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .section-content {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
}

/* =================================
   Error-sida
   ================================= */

body.error-page {
    font-family: var(--font-sans);
    background-color: var(--corp-bg-light);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--corp-primary);
}

.error-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    width: 100%;
    padding: 60px 40px;
    text-align: center;
}

.error-logo {
    height: 50px;
    margin-bottom: 40px;
}

.error-code {
    font-size: 72px;
    font-weight: 700;
    color: var(--corp-primary);
    margin-bottom: 20px;
    line-height: 1;
}

.error-container h1 {
    color: var(--corp-primary);
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: 600;
}

.error-message {
    color: var(--corp-text-gray);
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 30px;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

.support-info {
    background: var(--corp-bg-light);
    border-radius: 4px;
    padding: 25px;
    margin: 30px 0;
}

    .support-info h2 {
        font-size: 18px;
        color: var(--corp-primary);
        margin-bottom: 15px;
        font-weight: 600;
    }

    .support-info p {
        color: var(--corp-text-gray);
        font-size: 14px;
        line-height: 1.8;
    }

    .support-info a {
        color: var(--corp-primary);
        text-decoration: none;
        font-weight: 500;
    }

        .support-info a:hover {
            text-decoration: underline;
        }

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.error-btn {
    padding: 12px 30px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 15px;
    display: inline-block;
}

.error-btn-primary {
    background: var(--corp-primary);
    color: white;
}

    .error-btn-primary:hover {
        background: #002040;
        transform: translateY(-1px);
    }

.error-btn-secondary {
    background: white;
    color: var(--corp-primary);
    border: 1px solid var(--corp-border);
}

    .error-btn-secondary:hover {
        background: var(--corp-bg-light);
    }

.request-id {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--corp-border);
    color: var(--corp-text-gray);
    font-size: 13px;
}

    .request-id code {
        background: var(--corp-bg-light);
        padding: 4px 8px;
        border-radius: 3px;
        font-family: monospace;
        color: var(--corp-primary);
        font-size: 12px;
        margin: 0 4px;
    }

    .request-id p {
        margin-top: 8px;
        font-size: 12px;
        color: var(--corp-text-gray);
    }

@media (max-width: 600px) {
    .error-container {
        padding: 40px 20px;
    }

    .error-code {
        font-size: 56px;
    }

    .error-container h1 {
        font-size: 20px;
    }

    .error-message {
        font-size: 15px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .error-btn {
        width: 100%;
    }
}


.danger {
    padding: 5px 5px 5px 5px;
    background-color: #CF2020;
    color: #ffffff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-overflow: " [..]";
}

.neutral {
    padding: 5px 5px 5px 5px;
    color: var(--corp-primary);
    background-color: #fff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-overflow: " [..]";
}

.financials-table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
    max-width: 100%;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

    .financials-table-wrapper.is-scrolled .financials-table thead th:first-child,
    .financials-table-wrapper.is-scrolled .financials-table tbody td:first-child {
        box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    }

.financials-table {
    width: auto;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

    .financials-table th {
        padding: 0.75rem;
        text-align: right;
        font-weight: 600;
        color: #333;
        border-bottom: 2px solid #e5e5e5;
        background-color: #f8f8f8;
        white-space: nowrap;
    }

    .financials-table td {
        padding: 0.75rem;
        vertical-align: top;
        border-bottom: 1px solid #e5e5e5;
        border-right: 1px solid #e5e5e5;
        text-align: right;
        white-space: nowrap;
    }

    .financials-table thead th:first-child,
    .financials-table tbody td:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
        background-color: white;
        text-align: left !important;
        min-width: 200px;
        max-width: 300px;
        white-space: normal;
        word-wrap: break-word;
    }

    .financials-table thead th:first-child {
        background-color: #f8f8f8;
        z-index: 2;
        font-weight: 700;
    }

    .financials-table tbody td:first-child {
        font-weight: 600;
        border-right: 2px solid #e5e5e5;
    }

    .financials-table tbody tr:last-child td {
        border-bottom: none;
    }

    .financials-table tbody tr:hover {
        background-color: #fafafa;
    }

        .financials-table tbody tr:hover td:first-child {
            background-color: #fafafa;
        }

    .financials-table.table-divider td {
        border-bottom: 1px solid #e5e5e5;
    }

    .financials-table.table-divider tbody tr:last-child td {
        border-bottom: 1px solid #e5e5e5;
    }

    .financials-table td[colspan="2"] img {
        width: 100%;
        height: auto;
        max-width: 100%;
        max-height: 600px;
        display: block;
        object-fit: contain;
        margin: 0 auto;
        padding: 0;
        box-sizing: border-box;
    }

    .financials-table td[colspan="2"] {
        padding: 0.5rem;
        text-align: left;
        overflow: hidden;
    }

.CellWithComment {
    position: relative;
    cursor: pointer;
}


.CellComment {
    display: none;
    position: absolute;
    z-index: 100;
    border: 1px;
    background-color: white;
    border-style: solid;
    border-width: 1px;
    border-color: red;
    padding: 3px;
    color: red;
    top: 20px;
    left: 20px;
    font-size: 0.8em;
}

.CellWithComment:hover span.CellComment {
    display: block;
}


.pdf-wrapper {
    z-index: 100000;
    height: 100vh;
    width: 50%;
    min-width: 300px;
    position: fixed;
    background: white;
    top: 0;
    right: 0;
    border-left: 1px solid var(--corp-border);
    display: flex;
    flex-direction: column;
    --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
    box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}

#pdf-viewer {
    overflow-y: scroll;
}

.pdf-action-bar {
    padding: 10px 10px 10px 10px;
    border-bottom: 1px solid var(--corp-border);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}


.iframe-wrapper {
    z-index: 100000;
    height: 100vh;
    width: 80%;
    min-width: 800px;
    position: fixed;
    background: white;
    top: 0;
    right: 0;
    border-left: 1px solid var(--corp-border);
    display: flex;
    flex-direction: column;
    --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
    box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}

.iframe-action-bar {
    padding: 10px 10px 10px 10px;
    border-bottom: 1px solid var(--corp-border);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.frame-wrapper {
    height: 100vh;
    width: 80%;
    min-width: 800px;
    position: fixed;
    background: white;
    top: 0;
    right: 0;
    border-left: 1px solid var(--corp-border);
    display: flex;
    flex-direction: column;
    --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
    box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}

.frame-action-bar {
    padding: 10px 10px 10px 10px;
    border-bottom: 1px solid var(--corp-border);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.trademark-image-container {
    width: 200px;
    border: 1px solid var(--corp-border);
}

    .trademark-image-container img {
        max-height: 100%;
        max-width: 100%;
    }

.status-badge {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid #CF2020;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

    .status-badge.red {
        background-color: #cc3300;
        border: 1px solid #cc3300;
        color: #ffffff;
    }

    .status-badge.yellow {
        background-color: #ffcc00;
        border: 1px solid #ffcc00;
    }

    .status-badge.green {
        background-color: #339900;
        border: 1px solid #339900;
    }

    .status-badge.neutral {
        background: var(--corp-bg-light);
        border: 1px solid var(--corp-border);
    }

.company-wrapper {
    position: relative;
    height: 400px;
    background: var(--corp-bg-light);
    transition: all 0.3s ease-in-out;
}

.company-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem;
    background-color: #181818;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23c2c2c2' fill-opacity='0.4'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    color: white;
}

.company-hero {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.hero-identity-block {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--corp-border);
    padding-bottom: 1.5rem;
}

.hero-company-name {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 400;
    margin: 0 0 0.5rem 0;
    color: var(--corp-primary);
    letter-spacing: 0.02em;
}

.hero-company-details {
    font-size: 1rem;
    color: var(--corp-text-gray);
    margin-bottom: 0.5rem;
}

.hero-company-details .separator {
    margin: 0 0.5rem;
    opacity: 0.5;
}

.hero-company-details .org-number {
    font-weight: 600;
    color: var(--corp-primary);
}

.hero-location {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--corp-text-gray);
    margin-top: 0.5rem;
}

.hero-location svg {
    flex-shrink: 0;
}

.hero-business-block {
    margin-bottom: 1.5rem;
    padding: 0;
}

.hero-industry {
    margin-bottom: 0.75rem;
}

.hero-industry .industry-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--corp-text-gray);
    margin-right: 0.75rem;
}

.hero-industry .industry-code {
    font-weight: 600;
    color: var(--corp-primary);
    margin-right: 0.5rem;
}

.hero-industry .industry-desc {
    color: var(--corp-text-gray);
}

.hero-purpose {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--corp-primary);
    font-style: italic;
    padding-left: 1rem;
    border-left: 3px solid var(--corp-primary);
    opacity: 0.9;
}

.hero-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hero-alert-strip {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(220, 53, 69, 0.05);
    border: 1px solid rgba(220, 53, 69, 0.2);
    border-radius: var(--radius-md);
}

@media (max-width: 1024px) {
    .hero-company-name {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .company-hero {
        padding: 1.5rem;
        border-radius: var(--radius-md);
    }
    
    .hero-company-name {
        font-size: 1.75rem;
    }
    
    .hero-purpose {
        font-size: 0.9rem;
        padding-left: 0.75rem;
    }
}

@media (max-width: 480px) {
    .hero-company-name {
        font-size: 1.5rem;
    }
    
    .hero-company-details {
        font-size: 0.9rem;
    }
}

.fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    padding: 0;
    background: white;
    border: 1px solid #999;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.fullscreen-btn svg {
    stroke: #333;
    width: 20px;
    height: 20px;
    display: block;
    margin: 0 auto;
    padding: 0;
    flex-shrink: 0;
    position: relative;
}

.fullscreen-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

.graph-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: white;
    border-radius: 0 !important;
}

.graph-fullscreen #graph-details {
    position: fixed !important;
    z-index: 10000 !important;
}

.graph-fullscreen .fullscreen-btn {
    z-index: 10001 !important;
}

/* Popovern i Orb */
.graph-details-popover {
    position: absolute;
    width: 420px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--corp-border);
    overflow: hidden;
    z-index: 100;
}

.graph-details-header {
    background: var(--corp-bg-light);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--corp-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.graph-details-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--corp-primary);
    margin: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.graph-details-close {
    background: white;
    border: 1px solid var(--corp-border);
    border-radius: var(--radius-md);
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--corp-text-gray);
    transition: all 0.2s;
    font-weight: 500;
    min-width: 60px;
}

.graph-details-close:hover {
    background: var(--corp-primary);
    color: white;
    border-color: var(--corp-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 16, 32, 0.1);
}

.graph-details-content {
    padding: 1.25rem;
    max-height: 400px;
    overflow-y: auto;
}

.graph-details-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.graph-details-list li {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f5f5f5;
}

.graph-details-list li:last-child {
    border-bottom: none;
}

.graph-details-label {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--corp-text-gray);
    margin-right: 1rem;
    min-width: 120px;
    flex-shrink: 0;
    line-height: 1.5;
}

.graph-details-value {
    flex: 1;
    color: var(--corp-primary);
    font-size: 0.875rem;
    line-height: 1.5;
    font-weight: 500;
}

.graph-details-actions {
    padding: 1rem 1.25rem;
    background: var(--corp-bg-light);
    border-top: 1px solid var(--corp-border);
}

.graph-details-link {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    background: var(--corp-primary);
    color: white;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
}

.graph-details-link:hover {
    background: #001830;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 16, 32, 0.15);
    color: white;
    text-decoration: none;
}

/* Scrollbar styling for the details content */
.graph-details-content::-webkit-scrollbar {
    width: 6px;
}

.graph-details-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.graph-details-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.graph-details-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.graph-fullscreen .graph-details-popover {
    position: fixed;
    top: 80px;
    right: 20px;
}


.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-container {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 1200px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e5e5;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: #f5f5f5;
}

.modal-body {
    padding: 1.5rem;
    overflow: auto;
    flex: 1;
}

.representative-link,
.representative-engagements-link {
    color: #0066cc;
    text-decoration: none;
    cursor: pointer;
}

.representative-link:hover,
.representative-engagements-link:hover {
    text-decoration: underline;
}

.main-content {
    padding-bottom: 200px;
}

.tree-container {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 24px;
    margin: 16px 0;
    overflow-x: auto;
    min-height: 400px;
    position: relative;
}

.tree-node {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 8px 0;
    position: relative;
}

.tree-node-content {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px 16px;
    min-width: 280px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    position: relative;
}

.tree-node-content:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.tree-node-content.selected {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tree-node-content.has-debt {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.03);
    border-width: 2px;
}

.tree-node-content.has-intelligence {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.03);
    border-width: 2px;
}

.tree-node-content.has-multiple-issues {
    border-color: #dc2626;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.03) 50%, rgba(245, 158, 11, 0.03) 50%);
    border-width: 2px;
}

.tree-node-content.is-ceased {
    background: #f9fafb;
    opacity: 0.7;
}

.tree-node-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.tree-node-name {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
    flex: 1;
    margin-right: 8px;
    font-size: 14px;
}

.tree-node-indicators {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-indicator.debt {
    background-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

.status-indicator.intelligence {
    background-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.status-indicator.ceased {
    background-color: #6b7280;
    box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.2);
}

.tree-node-details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.detail-label {
    font-weight: 500;
    color: var(--text-primary);
}

.detail-value {
    font-family: monospace;
}

.ownership-badge {
    background: #10b981;
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    position: absolute;
    top: -10px;
    left: -35px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.9);
}

.tree-children {
    margin-left: 32px;
    padding-left: 16px;
    border-left: 2px solid var(--border-color);
    position: relative;
}

.tree-children::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 16px;
    width: 16px;
    height: 2px;
    background: var(--border-color);
}

.tree-children .tree-node:last-child {
    position: relative;
}

.tree-children .tree-node:last-child::after {
    content: '';
    position: absolute;
    left: -18px;
    top: 24px;
    bottom: 0;
    width: 2px;
    background: white;
}

.tree-legend {
    position: absolute;
    top: 16px;
    right: 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.legend-title {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 12px;
    min-width: 200px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.legend-text {
    color: var(--text-primary);
    font-weight: 500;
}

.legend-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-indicator.selected-indicator {
    background: var(--primary-color);
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.legend-indicator.debt-indicator {
    background: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

.legend-indicator.intelligence-indicator {
    background: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.legend-indicator.ceased-indicator {
    background: #6b7280;
    box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.2);
}

.empty-tree {
    text-align: center;
    padding: 48px;
    color: var(--text-secondary);
}

.empty-tree-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
    color: var(--text-secondary);
}

.empty-tree h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-tree p {
    color: var(--text-secondary);
    margin: 0;
}

.country-flag-icon {
    width: 20px;
    height: 15px;
    margin-right: 6px;
    vertical-align: middle;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: inline-block;
}

.tree-expand-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.tree-expand-btn:hover {
    background: #1e40af;
}

@media (max-width: 768px) {
    .tree-legend {
        position: static;
        margin-bottom: 16px;
    }
    
    .legend-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px 8px;
    }
    
    .tree-children {
        margin-left: 16px;
        padding-left: 12px;
    }
    
    .tree-node-content {
        min-width: 240px;
    }
}

@media print {
    .tree-container {
        page-break-inside: avoid;
        border: 1px solid #e5e7eb;
    }
    
    .tree-legend {
        position: static;
        margin-bottom: 16px;
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
    
    .tree-node-content {
        box-shadow: none;
        border: 1px solid #d1d5db;
    }
    
    .tree-expand-btn {
        display: none;
    }
}
