        /* ─── Theme variables (v17.19 Dark Mode) ─────────────────────────────
           Scaffolding-only scope: body, container, hoofdtabel, login, user-info.
           Modal-interiors blijven zoals ze waren (out of scope, eigen US later). */
        :root {
            --bg-body: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --bg-surface: #ffffff;
            --bg-surface-alt: #f8f9fa;
            --bg-surface-alt-2: #f0f4ff;
            --bg-surface-hover: #e1e9ff;
            --text-primary: #333333;
            --text-secondary: #666666;
            --text-muted: #6c757d;
            --border-color: #eeeeee;
            --border-color-strong: #e0e0e0;
            --shadow: 0 10px 30px rgba(0,0,0,0.3);

            --th-purchase-bg: #a3c4f3; --th-purchase-fg: #1a3a6b;
            --th-current-bg:  #ffd8a8; --th-current-fg:  #7d4e00;
            --th-pl-bg:       #b8e6b8; --th-pl-fg:       #1a5c1a;
            --th-div-bg:      #fff9c4; --th-div-fg:      #7d6e00;
            --td-purchase-bg: #e7f2ff;
            --td-current-bg:  #fff4e6;
            --td-pl-bg:       #e8f5e8;
            --td-div-bg:      #fffde7;
            --bg-group-detail: #fafbff;
            --bg-empty-cell:   #f5f5f5;
            --text-empty-cell: #d1d5db;

            /* Form panel tinten (Vermogen modal: spaar=blauw, pensioen=violet, immo=amber, editing=yellow) */
            --bg-form-blue:     #eff6ff; --border-form-blue:     #bfdbfe;
            --bg-form-violet:   #f5f3ff; --border-form-violet:   #ddd6fe;
            --bg-form-amber:    #fffbeb; --border-form-amber:    #fde68a;
            --bg-editing-row:   #fef3c7;

            --bg-input: #ffffff;
        }

        :root[data-theme="dark"] {
            --bg-body: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
            --bg-surface: #1e1e2e;
            --bg-surface-alt: #2a2a3e;
            --bg-surface-alt-2: #2f3145;
            --bg-surface-hover: #3a3a4e;
            --text-primary: #e5e7eb;
            --text-secondary: #b8bdc6;
            --text-muted: #9ca3af;
            --border-color: #3a3a4e;
            --border-color-strong: #4b5563;
            --shadow: 0 10px 30px rgba(0,0,0,0.5);

            --th-purchase-bg: #2c4368; --th-purchase-fg: #c5d8f3;
            --th-current-bg:  #4a3621; --th-current-fg:  #f4d9b1;
            --th-pl-bg:       #1f4a1f; --th-pl-fg:       #b8e6b8;
            --th-div-bg:      #4a4321; --th-div-fg:      #fff9c4;
            --td-purchase-bg: #1a2540;
            --td-current-bg:  #2f2218;
            --td-pl-bg:       #18301a;
            --td-div-bg:      #2f2c17;
            --bg-group-detail: #25253a;
            --bg-empty-cell:   #25253a;
            --text-empty-cell: #6b7280;

            --bg-form-blue:     #1d2941; --border-form-blue:     #2c4368;
            --bg-form-violet:   #2a1f3f; --border-form-violet:   #4a3673;
            --bg-form-amber:    #3a2f1a; --border-form-amber:    #6b4423;
            --bg-editing-row:   #3a3520;

            --bg-input: #2a2a3e;
        }

        /* Vermogen modal inputs: geen inline bg/color → moeten via override */
        :root[data-theme="dark"] #vermogenContent input {
            background: var(--bg-input);
            color: var(--text-primary);
        }

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

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            background: var(--bg-body);
            padding: 5px 10px 20px 5px; /* top right bottom left - minimal left padding! */
            min-height: 100vh;
            overflow-x: auto;
        }

        .container {
            min-width: 1600px;
            width: fit-content;
            margin: 0 auto;
            background: var(--bg-surface);
            border-radius: 15px;
            box-shadow: var(--shadow);
            padding: 15px 30px 30px 30px; /* v15.33 - top padding reduced */
        }

        h1 {
            display: none; /* v15.33 - Hidden, moved to summary */
        }

        /* Login Page */
        #login-page {
            text-align: center;
            padding: 50px 20px;
        }

        #login-page h2 {
            color: var(--text-primary);
            margin-bottom: 30px;
        }
        #login-page p {
            color: var(--text-secondary);
        }

        .login-btn {
            background: #4285f4;
            color: white;
            border: none;
            padding: 15px 30px;
            font-size: 16px;
            border-radius: 5px;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 10px;
            transition: background 0.3s;
        }

        .login-btn:hover {
            background: #357ae8;
        }

        /* Top Container - User Info + Summary */
        .top-container {
            display: flex;
            justify-content: space-between;
            align-items: stretch; /* v15.33 - stretch to same height */
            gap: 15px;
            margin-bottom: 10px; /* v15.33 - reduced from 20px */
        }

        /* User Info Box (right) */
        .user-info {
            flex: 0 0 auto;
            background: var(--bg-surface-alt);
            padding: 10px 15px; /* v15.33 - reduced padding */
            border-radius: 10px;
            border: 2px solid var(--border-color-strong);
            margin: 0;
            display: flex;
            flex-direction: column;
            justify-content: center;
            color: var(--text-primary);
        }

        .user-details {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 5px; /* v15.33 - reduced */
        }

        .user-avatar {
            width: 32px; /* v15.33 - smaller */
            height: 32px;
            border-radius: 50%;
        }

        .sync-status {
            font-size: 11px; /* v15.33 - smaller */
            color: #28a745;
            margin-top: 3px;
            display: block;
        }

        .cache-info {
            font-size: 10px; /* v15.33 - smaller */
            color: #6c757d;
            margin-top: 2px;
            font-style: italic;
        }

        .logout-btn {
            background: #dc3545;
            color: white;
            border: none;
            padding: 5px 12px; /* v15.33 - smaller */
            border-radius: 5px;
            cursor: pointer;
            font-size: 12px; /* v15.33 - smaller */
            width: 100%;
        }

        .logout-btn:hover {
            background: #c82333;
        }

        /* Summary Box (left) - v15.58 compact 2x2 grid */
        .summary {
            flex: 0 0 35%; /* v15.58 - 35% width (was 50%) */
            max-width: 35%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 10px 15px;
            border-radius: 10px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
            margin: 0;
            display: grid;
            grid-template-columns: 1fr auto;
            grid-template-rows: auto auto;
            gap: 6px 15px;
            align-items: center;
        }

        .summary-value {
            font-size: 22px;
            font-weight: bold;
            color: white;
        }

        .summary-version {
            font-size: 13px;
            text-align: right;
            opacity: 0.95;
        }

        .summary-update {
            font-size: 12px;
            text-align: right;
            opacity: 0.85;
        }

        /* v11.91 - Override positive/negative colors in summary to white */
        .summary .positive,
        .summary .negative {
            color: white;
        }

        /* v15.58 - Compact Update Button in Summary */
        .big-update-btn {
            padding: 5px 8px; /* smaller padding */
            font-size: 11px;
            font-weight: 600;
            background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
            border: none;
            border-radius: 5px;
            color: white;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 2px 6px rgba(59,130,246,0.4);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 3px;
            white-space: nowrap;
        }

        .big-update-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(59,130,246,0.6);
            background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
        }

        .big-update-btn:active {
            transform: translateY(0);
            box-shadow: 0 4px 15px rgba(59,130,246,0.4);
        }

        .big-update-btn:disabled {
            background: #94a3b8;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .controls {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        button {
            background: #667eea;
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
            transition: background 0.3s;
        }

        button:hover {
            background: #5568d3;
        }

        button:disabled {
            background: #ccc;
            cursor: not-allowed;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
            background: var(--bg-surface);
            color: var(--text-primary);
            table-layout: auto; /* v16.09 - auto sizing, fixes column overflow */
        }

        th {
            background: #667eea;
            color: white;
            padding: 6px 8px; /* v15.31 - compacter (was 9px 10px) */
            text-align: left;
            font-weight: 600;
            cursor: pointer;
            user-select: none;
            position: relative;
        }

        th.purchase-group {
            background: var(--th-purchase-bg);
            color: var(--th-purchase-fg);
        }

        th.current-group {
            background: var(--th-current-bg);
            color: var(--th-current-fg);
        }

        th.profit-loss-group {
            background: var(--th-pl-bg);
            color: var(--th-pl-fg);
        }

        th.dividend-group {
            background: var(--th-div-bg);
            color: var(--th-div-fg);
        }

        td.purchase-col {
            background: var(--td-purchase-bg);
        }

        td.current-col {
            background: var(--td-current-bg);
        }

        td.profit-loss-col {
            background: var(--td-pl-bg);
        }

        td.dividend-col {
            background: var(--td-div-bg);
        }

        /* v16.09 - right-align all numeric/value columns */
        td.price-col { text-align: right; white-space: nowrap; }
        td.current-col { text-align: right; }
        td.purchase-col:not(.stock-name):not(.empty-cell) { text-align: right; }
        td.profit-loss-col:not(.empty-cell) { text-align: right; }
        td.dividend-col:not(.empty-cell) { text-align: right; }
        th.price-col { text-align: right; }

        th:hover {
            background: #5568d3;
        }

        th.purchase-group:hover {
            background: #8bb4ed;
        }

        th.current-group:hover {
            background: #ffc078;
        }

        th.profit-loss-group:hover {
            background: #a0d8a0;
        }

        th.dividend-group:hover {
            background: #fff59d;
        }

        /* v13.43 - Sold table color groups */
        .sold-table th.info-group {
            background: #a3c4f3;
            color: #1a3a6b;
        }

        .sold-table th.purchase-group {
            background: #a3c4f3;
            color: #1a3a6b;
        }

        .sold-table th.sale-group {
            background: #ffb3b3;
            color: #7d0000;
        }

        .sold-table th.result-group {
            background: #b8e6b8;
            color: #1a5c1a;
        }

        .sold-table th.dividend-group {
            background: #fff9c4;
            color: #7d6e00;
        }

        .sold-table td.info-col {
            background: #e7f2ff;
        }

        .sold-table td.purchase-col {
            background: #e7f2ff;
        }

        .sold-table td.sale-col {
            background: #ffe6e6;
        }

        .sold-table td.result-col {
            background: #e8f5e8;
        }

        .sold-table td.dividend-col {
            background: #fffde7;
        }

        th.sorted-asc::after {
            content: ' ▲';
            font-size: 10px;
        }

        th.sorted-desc::after {
            content: ' ▼';
            font-size: 10px;
        }

        td {
            padding: 5px 8px; /* v15.31 - nog compacter (was 7px 10px) */
            border-bottom: 1px solid var(--border-color);
            color: var(--text-primary);
            white-space: nowrap; /* v16.09 - prevent wrapping */
        }

        tr:hover {
            background: var(--bg-surface-alt);
        }

        tr.group-header {
            background: var(--bg-surface-alt-2);
            font-weight: 600;
            cursor: pointer;
        }

        tr.single-purchase {
            font-weight: 600;
        }

        tr.group-header:hover {
            background: var(--bg-surface-hover);
        }

        tr.group-header td {
            border-top: 2px solid #667eea;
            border-bottom: 2px solid #667eea;
        }

        tr.group-detail {
            background: var(--bg-group-detail);
        }

        tr.group-detail.hidden {
            display: none;
        }

        .expand-icon {
            display: inline-block;
            margin-right: 6px;
            transition: transform 0.2s;
            font-size: 12px;
            vertical-align: middle;
        }

        .expand-icon.expanded {
            transform: rotate(90deg);
        }

        /* Klikbare aandeelnaam/ticker → opent de detail-modal (openStockDetail). */
        .stock-link {
            cursor: pointer;
            text-decoration: underline;
        }
        .stock-link:hover {
            color: #06b6d4;
        }

        /* v18.33 — vereenvoudigde hoofdtabel: enkel 3M (3), Naam (4), Koers (6), Δ% (7), Waarde € (10).
           Elke groeps-/detailrij heeft vaste 18 cellen; de kop gebruikt .simple-keep. */
        .simple-table-toggle {
            /* vierkant, even hoog als #totalValue (line-height 26px + 2×8px padding) */
            width: 42px;
            height: 42px;
            flex-shrink: 0;
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(0,0,0,0.28);
            border: 1px solid rgba(255,255,255,0.35);
            border-radius: 6px;
            color: #fff;
            cursor: pointer;
            font-size: 20px;
            line-height: 1;
        }
        .simple-table-toggle:hover { background: rgba(0,0,0,0.42); }
        .simple-table-toggle.active { background: #fff; color: #667eea; }
        #portfolioTable .simple-total-row { display: none; }
        #portfolioTable.simple-view .full-total-row { display: none; }
        #portfolioTable.simple-view .simple-total-row { display: table-row; }
        #portfolioTable.simple-view thead th:not(.simple-keep) { display: none; }
        #portfolioTable.simple-view tbody tr:not(.totals-row) > td:not(:nth-child(3)):not(:nth-child(4)):not(:nth-child(6)):not(:nth-child(7)):not(:nth-child(10)) { display: none; }
        #portfolioTable.simple-view { width: auto; }
        #portfolioTable.simple-view td.stock-name { max-width: 280px; }

        td.empty-cell {
            background: var(--bg-empty-cell);
            color: var(--text-empty-cell);
            text-align: center;
            font-style: italic;
        }

        .stock-name {
            cursor: help;
            position: relative;
            width: 160px;
            max-width: 160px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .stock-name-text {
            display: inline;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            vertical-align: middle;
        }

        /* v15.31 - Ensure td.stock-name truncates properly */
        td.stock-name {
            width: 160px;
            max-width: 160px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .stock-name:hover .tooltip {
            display: block;
        }

        .tooltip {
            display: none;
            position: absolute;
            background: #333;
            color: white;
            padding: 10px;
            border-radius: 5px;
            font-size: 12px;
            z-index: 10000;
            white-space: nowrap;
            bottom: 100%;
            left: 0;
            margin-bottom: 5px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.3);
            pointer-events: none;
        }

        .tooltip::after {
            content: '';
            position: absolute;
            top: 100%;
            left: 20px;
            border: 5px solid transparent;
            border-top-color: #333;
        }

        .positive {
            color: #28a745;
            font-weight: 600;
        }

        .negative {
            color: #dc3545;
            font-weight: 600;
        }

        .action-buttons {
            display: flex;
            gap: 5px;
        }

        .edit-btn, .delete-btn {
            padding: 6px 12px;
            font-size: 14px;
            border-radius: 3px;
        }

        .edit-btn {
            background: #ffc107;
        }

        .edit-btn:hover {
            background: #e0a800;
        }

        .delete-btn {
            background: #dc3545;
        }

        .delete-btn:hover {
            background: #c82333;
        }

        .sell-btn {
            background: #28a745;
            margin-left: 10px;
        }

        .sell-btn:hover {
            background: #218838;
        }

        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.5);
            z-index: 1000;
        }

        .modal-content {
            background: var(--bg-surface);
            color: var(--text-primary);
            max-width: 600px;
            margin: 50px auto;
            padding: 30px;
            border-radius: 10px;
            max-height: 90vh;
            overflow-y: auto;
            /* v15.29 - Draggable & Resizable */
            position: absolute;
            left: 50%;
            top: 50px;
            transform: translateX(-50%);
            resize: both;
            overflow: auto;
            min-width: 400px;
            min-height: 200px;
        }

        /* v15.29 - Resize handle indicator */
        .modal-content::after,
        .distribution-content::after,
        .historical-content::after,
        .portfolio-evolution-content::after,
        .transaction-history-content::after {
            content: '';
            position: absolute;
            bottom: 5px;
            right: 5px;
            width: 15px;
            height: 15px;
            border-right: 3px solid #667eea;
            border-bottom: 3px solid #667eea;
            opacity: 0.5;
            pointer-events: none;
        }

        .modal-content h2 {
            margin-bottom: 20px;
            color: var(--text-primary);
            /* v15.29 - Make header draggable */
            cursor: move;
            user-select: none;
        }

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

        label {
            display: block;
            margin-bottom: 5px;
            color: var(--text-primary);
            font-weight: 500;
        }

        input, select {
            width: 100%;
            padding: 10px;
            border: 1px solid var(--border-color-strong);
            border-radius: 5px;
            font-size: 16px;
            background: var(--bg-surface);
            color: var(--text-primary);
        }

        input:focus, select:focus {
            outline: none;
            border-color: #667eea;
        }

        .modal-buttons {
            display: flex;
            gap: 10px;
            margin-top: 20px;
        }

        .modal-buttons button {
            flex: 1;
        }

        /* v14.24 - Universal close button styling */
        .close {
            position: absolute;
            right: 20px;
            top: 20px;
            font-size: 36px;
            font-weight: 700;
            color: #fff;
            background: #ef4444;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
            z-index: 10;
            line-height: 1;
            box-shadow: 0 2px 8px rgba(0,0,0,0.3);
        }

        .close:hover {
            background: #dc2626;
            transform: scale(1.1);
            box-shadow: 0 4px 12px rgba(239,68,68,0.5);
        }

        .cancel-btn {
            background: #6c757d;
        }

        .cancel-btn:hover {
            background: #5a6268;
        }

        .loading {
            text-align: center;
            padding: 20px;
            color: #667eea;
            font-size: 18px;
        }

        .error-msg {
            background: #f8d7da;
            color: #721c24;
            padding: 12px;
            border-radius: 5px;
            margin-bottom: 15px;
            display: none;
        }

        .info-box {
            background: #e7f3ff;
            border-left: 4px solid #2196F3;
            padding: 15px;
            margin-bottom: 20px;
            border-radius: 5px;
        }

        details {
            margin-top: 10px;
        }

        summary {
            cursor: pointer;
            font-weight: bold;
            padding: 5px;
        }

        summary:hover {
            background: #d0e7ff;
        }

        /* v11.0 - Verkoop Tracking Styles */
        .section-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 15px 20px;
            margin: 30px 0 10px 0;
            border-radius: 8px;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            user-select: none;
            font-size: 18px;
            font-weight: 600;
        }

        .section-header:hover {
            opacity: 0.9;
        }

        .section-header.sold {
            background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
        }

        .section-toggle {
            font-size: 20px;
            transition: transform 0.3s;
        }

        .section-toggle.collapsed {
            transform: rotate(-90deg);
        }

        .section-content {
            display: block;
        }

        .section-content.hidden {
            display: none;
        }

        .sold-table tbody tr {
            background: #f0fff0;
        }

        .sold-table tbody tr:hover {
            background: #e0ffe0;
        }

        /* v17.40 — Verkocht-tabel leesbaar in dark mode: de hardgecodeerde lichte
           pastel-cellen gaven witte tekst op bijna-witte achtergrond. Donkere tinten
           per groep (blauw/rood/groen/geel) + lichte tekst. result-col houdt geen
           kleur-override zodat de .positive/.negative P/L-kleuren blijven gelden. */
        :root[data-theme="dark"] .sold-table tbody tr { background: #1e1e2e; }
        :root[data-theme="dark"] .sold-table tbody tr:hover { background: #252535; }
        :root[data-theme="dark"] .sold-table td.info-col,
        :root[data-theme="dark"] .sold-table td.purchase-col,
        :root[data-theme="dark"] .sold-table td.sale-col,
        :root[data-theme="dark"] .sold-table td.dividend-col { color: #e5e7eb; }
        :root[data-theme="dark"] .sold-table td.info-col     { background: #1c2740; }
        :root[data-theme="dark"] .sold-table td.purchase-col { background: #1c2740; }
        :root[data-theme="dark"] .sold-table td.sale-col     { background: #3a2128; }
        :root[data-theme="dark"] .sold-table td.result-col   { background: #1d3326; }
        :root[data-theme="dark"] .sold-table td.dividend-col { background: #322c17; }

        /* Loading Overlay */
        #loadingOverlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            z-index: 10000;
            justify-content: center;
            align-items: center;
            flex-direction: column;
        }

        .loading-spinner {
            border: 5px solid #f3f3f3;
            border-top: 5px solid #667eea;
            border-radius: 50%;
            width: 60px;
            height: 60px;
            animation: spin 1s linear infinite;
        }

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

        #loadingText {
            color: white;
            margin-top: 20px;
            font-size: 18px;
        }

        /* Success Message */
        #successMsg {
            display: none;
            position: fixed;
            top: 20px;
            right: 20px;
            background: #28a745;
            color: white;
            padding: 15px 25px;
            border-radius: 5px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.3);
            z-index: 9999;
            animation: slideIn 0.3s ease-out;
        }

        @keyframes slideIn {
            from {
                transform: translateX(400px);
                opacity: 0;
            }
            to {
                transform: translateX(0);
                opacity: 1;
            }
        }

        /* Mobile-friendly tooltips */
        @media (max-width: 768px) {
            .tooltip {
                position: fixed;
                left: 50% !important;
                top: 50% !important;
                transform: translate(-50%, -50%);
                white-space: normal;
                max-width: 80%;
                bottom: auto !important;
            }
            
            /* v15.91 - Corporate Actions Modal mobile responsive */
            #corporateActionsModal .modal-content {
                width: 100% !important;
                max-width: 100% !important;
                min-width: unset !important;
                min-height: unset !important;
                max-height: 100vh !important;
                border-radius: 0 !important;
                margin: 0 !important;
                left: 0 !important;
                top: 0 !important;
                transform: none !important;
                position: fixed !important;
                height: 100vh !important;
            }
            
            #corporateActionsModal .ca-drag-header {
                border-radius: 0 !important;
                padding: 12px 15px !important;
                cursor: default !important;
            }
            
            #corporateActionsModal .ca-drag-header h2 {
                font-size: 18px !important;
            }
            
            #newCorporateActionsContent {
                padding: 0 10px 15px 10px !important;
            }
            
            /* v15.91 - Capital Gains Modal mobile responsive */
            #capitalGainsModal .modal-content {
                width: 100% !important;
                max-width: 100% !important;
                min-width: unset !important;
                min-height: unset !important;
                max-height: 100vh !important;
                border-radius: 0 !important;
                margin: 0 !important;
                left: 0 !important;
                top: 0 !important;
                transform: none !important;
                position: fixed !important;
                height: 100vh !important;
            }
            
            #capitalGainsModal .cg-drag-header {
                border-radius: 0 !important;
                padding: 12px 15px !important;
                cursor: default !important;
            }
            
            #capitalGainsModal .cg-drag-header h2 {
                font-size: 18px !important;
            }
            
            #capitalGainsContent {
                padding: 10px !important;
            }
            
            /* v15.91 - Strategy Modal mobile responsive */
            #strategyModal .modal-content {
                width: 100% !important;
                max-width: 100% !important;
                min-width: unset !important;
                min-height: unset !important;
                max-height: 100vh !important;
                border-radius: 0 !important;
                margin: 0 !important;
                left: 0 !important;
                top: 0 !important;
                transform: none !important;
                position: fixed !important;
                height: 100vh !important;
            }
            
            #strategyModal .st-drag-header {
                border-radius: 0 !important;
                padding: 12px 15px !important;
                cursor: default !important;
            }
            
            #strategyModal .st-drag-header h2 {
                font-size: 18px !important;
            }
            
            #strategyContent {
                padding: 10px !important;
            }
            
            /* v15.91 - Strategy Hub Modal mobile responsive */
            #strategyHubModal .modal-content {
                width: 100% !important;
                max-width: 100% !important;
                min-width: unset !important;
                min-height: unset !important;
                max-height: 100vh !important;
                border-radius: 0 !important;
                margin: 0 !important;
                left: 0 !important;
                top: 0 !important;
                transform: none !important;
                position: fixed !important;
                height: 100vh !important;
            }
            
            #strategyHubModal .sh-drag-header {
                border-radius: 0 !important;
                padding: 12px 15px !important;
                cursor: default !important;
            }
            
            #strategyHubModal .sh-drag-header h2 {
                font-size: 18px !important;
            }
            
            /* v15.91 - History Modal mobile responsive */
            #historyModal .modal-content {
                width: 100% !important;
                max-width: 100% !important;
                min-width: unset !important;
                min-height: unset !important;
                max-height: 100vh !important;
                border-radius: 0 !important;
                margin: 0 !important;
                left: 0 !important;
                top: 0 !important;
                transform: none !important;
                position: fixed !important;
                height: 100vh !important;
            }
            
            #historyModal .hi-drag-header {
                border-radius: 0 !important;
                padding: 12px 15px !important;
                cursor: default !important;
            }
            
            #historyModal .hi-drag-header h2 {
                font-size: 18px !important;
            }
            
            /* v15.91 - Sold Modal mobile responsive */
            #soldModal .modal-content {
                width: 100% !important;
                max-width: 100% !important;
                min-width: unset !important;
                min-height: unset !important;
                max-height: 100vh !important;
                border-radius: 0 !important;
                margin: 0 !important;
                left: 0 !important;
                top: 0 !important;
                transform: none !important;
                position: fixed !important;
                height: 100vh !important;
            }
            
            #soldModal .sold-drag-header {
                border-radius: 0 !important;
                padding: 12px 15px !important;
                cursor: default !important;
            }
            
            #soldModal .sold-drag-header h2 {
                font-size: 18px !important;
            }
            
            /* v15.91 - Distribution Modal mobile responsive */
            #distributionModal .distribution-content {
                width: 100% !important;
                max-width: 100% !important;
                min-width: unset !important;
                min-height: unset !important;
                max-height: 100vh !important;
                border-radius: 0 !important;
                margin: 0 !important;
                left: 0 !important;
                top: 0 !important;
                transform: none !important;
                position: fixed !important;
                height: 100vh !important;
            }
            
            #distributionModal .distribution-header {
                border-radius: 0 !important;
                padding: 12px 15px !important;
            }
            
            #distributionModal .distribution-header h2 {
                font-size: 18px !important;
            }
            
            /* v15.91 - WhatIf Modal mobile responsive */
            #whatIfModal .whatif-content {
                width: 100% !important;
                max-width: 100% !important;
                min-width: unset !important;
                min-height: unset !important;
                max-height: 100vh !important;
                border-radius: 0 !important;
                left: 0 !important;
                top: 0 !important;
                transform: none !important;
                position: fixed !important;
                height: 100vh !important;
            }
        }


        /* Dividend Review Modal */
        #dividendReviewModal {
            display: none;
            position: fixed;
            z-index: 1001;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
            overflow-y: auto;
        }

        .dividend-review-content {
            background-color: white;
            margin: 5% auto;
            padding: 30px;
            border-radius: 10px;
            width: 90%;
            max-width: 900px;
            max-height: 80vh;
            overflow-y: auto;
        }

        .dividend-stock-section {
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 15px;
            background: #f8f9fa;
        }

        .dividend-stock-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
            padding-bottom: 10px;
            border-bottom: 2px solid #667eea;
        }

        .dividend-stock-name {
            font-weight: bold;
            font-size: 18px;
            color: #333;
        }

        .dividend-total {
            font-size: 20px;
            font-weight: bold;
            color: #28a745;
        }

        .dividend-details {
            background: white;
            border-radius: 5px;
            padding: 10px;
            margin-top: 10px;
        }

        .dividend-item {
            display: flex;
            justify-content: space-between;
            padding: 5px 0;
            border-bottom: 1px solid #eee;
        }

        .dividend-item:last-child {
            border-bottom: none;
        }

        .dividend-warning {
            background: #fff3cd;
            border: 1px solid #ffc107;
            border-radius: 5px;
            padding: 10px;
            margin: 10px 0;
            color: #856404;
        }

        .dividend-success {
            background: #d4edda;
            border: 1px solid #28a745;
            border-radius: 5px;
            padding: 10px;
            margin: 10px 0;
            color: #155724;
        }


        /* Sort icons for table headers */
        th[onclick] {
            cursor: pointer;
            position: relative;
            padding-right: 20px;
        }

        th[onclick]::after {
            content: '⇅';
            position: absolute;
            right: 5px;
            opacity: 0.3;
            font-size: 12px;
        }

        th[onclick]:hover::after {
            opacity: 0.7;
        }

        th.sort-asc::after {
            content: '▲';
            opacity: 1;
            color: #667eea;
        }

        th.sort-desc::after {
            content: '▼';
            opacity: 1;
            color: #667eea;
        }


        /* Icon buttons for actions */
        .icon-btn {
            background: none;
            border: none;
            font-size: 18px;
            cursor: pointer;
            padding: 5px;
            transition: transform 0.2s;
        }

        .icon-btn:hover {
            transform: scale(1.2);
        }

        .edit-icon-btn {
            color: #667eea;
        }

        .edit-icon-btn:hover {
            color: #4c51bf;
        }

        .delete-icon-btn {
            color: #dc3545;
        }

        .delete-icon-btn:hover {
            color: #c82333;
        }


        /* Historical Data Modal */
        .historical-modal {
            display: none;
            position: fixed;
            z-index: 10000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.6);
        }

        .historical-modal-content {
            background-color: #1e1e2e;
            margin: 3% auto;
            padding: 0;
            border-radius: 8px;
            width: 80%;
            max-width: 900px;
            max-height: 85vh;
            overflow-y: auto;
            box-shadow: 0 4px 20px rgba(0,0,0,0.3);
        }

        .historical-modal-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            padding: 20px;
            border-radius: 8px 8px 0 0;
            color: white;
        }

        .historical-modal-header h2 {
            margin: 0;
            font-size: 24px;
        }

        .historical-modal-header p {
            margin: 5px 0 0 0;
            opacity: 0.9;
            font-size: 14px;
        }

        .historical-modal-body {
            padding: 25px;
            color: #e0e0e0;
        }

        .historical-stats {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px;
            margin-bottom: 20px;
        }

        .stat-box {
            background: #2a2a3e;
            padding: 15px;
            border-radius: 6px;
            border-left: 4px solid #667eea;
        }

        .stat-label {
            font-size: 12px;
            color: #d1d5db;
            text-transform: uppercase;
            margin-bottom: 5px;
        }

        .stat-value {
            font-size: 20px;
            font-weight: bold;
            color: #fff;
        }

        .stat-value.positive {
            color: #4ade80;
        }

        .stat-value.negative {
            color: #f87171;
        }

        .period-selector {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        .period-btn {
            padding: 8px 16px;
            background: #2a2a3e;
            border: 2px solid #3a3a4e;
            border-radius: 6px;
            color: #f3f4f6;
            cursor: pointer;
            transition: all 0.2s;
        }

        .period-btn:hover {
            border-color: #667eea;
            background: #3a3a4e;
        }

        .period-btn.active {
            background: #667eea;
            border-color: #667eea;
            color: white;
        }

        .data-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 15px;
            font-size: 13px;
        }

        .data-table th {
            background: #2a2a3e;
            padding: 10px;
            text-align: left;
            font-weight: 600;
            border-bottom: 2px solid #667eea;
        }

        .data-table td {
            padding: 8px 10px;
            border-bottom: 1px solid #3a3a4e;
        }

        .data-table tr:hover {
            background: #2a2a3e;
        }

        .close-historical {
            color: white;
            float: right;
            font-size: 32px;
            font-weight: bold;
            cursor: pointer;
            line-height: 20px;
        }

        .close-historical:hover {
            opacity: 0.7;
        }

        .loading-historical {
            text-align: center;
            padding: 40px;
            font-size: 18px;
            color: #d1d5db;
        }


        /* Portfolio Evolution Modal */
        .portfolio-evolution-modal {
            display: none;
            position: fixed;
            z-index: 10002;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.7);
        }

        .portfolio-evolution-content {
            background: linear-gradient(180deg, #1e1e2e 0%, #2a2a3e 100%);
            margin: 2% auto;
            padding: 0;
            border-radius: 12px;
            width: 90%;
            max-width: 1600px;
            max-height: 90vh;
            overflow-y: auto;
            box-shadow: 0 8px 32px rgba(0,0,0,0.5);
            /* v15.29 - Draggable & Resizable */
            position: absolute;
            left: 50%;
            top: 2%;
            transform: translateX(-50%);
            resize: both;
            overflow: auto;
            min-width: 600px;
            min-height: 400px;
        }

        .portfolio-evolution-header {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            padding: 25px 30px;
            border-radius: 12px 12px 0 0;
            color: white;
            position: relative;
        }

        .portfolio-evolution-header h2 {
            margin: 0;
            font-size: 28px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .close-portfolio-evolution {
            position: absolute;
            right: 20px;
            top: 20px;
            color: white;
            font-size: 32px;
            font-weight: bold;
            cursor: pointer;
            transition: opacity 0.2s;
        }

        .close-portfolio-evolution:hover {
            opacity: 0.7;
        }

        .portfolio-evolution-stats {
            display: grid;
            grid-template-columns: repeat(5, 1fr); /* v11.110 - Changed from 4 to 5 for cashflow box */
            gap: 20px;
            padding: 30px;
            background: #2a2a3e;
        }

        .pe-stat-box {
            background: #1e1e2e;
            padding: 20px;
            border-radius: 8px;
            text-align: center;
            border: 1px solid #3a3a4e;
        }

        /* v18.29 - uitleg per kerncijfer (Evolutie): tik/klik op het kader toont of verbergt ze — werkt ook op gsm */
        .pe-stat-box { cursor: pointer; }
        .pe-info-icon { font-size: 0.9em; opacity: 0.8; }
        .pe-stat-info {
            display: none;
            margin-top: 10px;
            padding-top: 8px;
            border-top: 1px solid #3a3a4e;
            font-size: 12px;
            line-height: 1.5;
            color: #cbd5e1;
            text-align: left;
            text-transform: none;
        }
        .pe-stat-box.pe-info-open .pe-stat-info { display: block; }

        .pe-stat-label {
            font-size: 12px;
            color: #d1d5db;
            text-transform: uppercase;
            margin-bottom: 10px;
        }

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

        .pe-stat-value.positive {
            color: #10b981;
        }

        .pe-stat-value.negative {
            color: #ef4444;
        }

        .pe-stat-subtitle {
            font-size: 14px;
            color: #666;
            margin-top: 5px;
        }

        .portfolio-evolution-chart-container {
            padding: 30px;
            background: #2a2a3e;
        }

        .portfolio-evolution-chart-box {
            background: #1e1e2e;
            padding: 30px;
            border-radius: 8px;
        }


        /* Portfolio Evolution Period Buttons */
        .pe-period-btn {
            padding: 8px 20px;
            background: #1e1e2e;
            border: 2px solid #3a3a4e;
            border-radius: 6px;
            color: #f3f4f6;
            cursor: pointer;
            font-size: 13px;
            font-weight: 600;
            transition: all 0.2s;
        }

        .pe-period-btn:hover {
            border-color: #10b981;
            background: #2a2a3e;
        }

        .pe-period-btn.active {
            background: #10b981;
            border-color: #10b981;
            color: white;
        }


        /* Transaction History Modal */
        .transaction-history-modal {
            display: none;
            position: fixed;
            z-index: 10003;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.7);
        }

        .transaction-history-content {
            background: linear-gradient(180deg, #1e1e2e 0%, #2a2a3e 100%);
            margin: 2% auto;
            padding: 0;
            border-radius: 12px;
            width: 90%;
            max-width: 1400px;
            max-height: 90vh;
            overflow-y: auto;
            box-shadow: 0 8px 32px rgba(0,0,0,0.5);
            /* v15.29 - Draggable & Resizable */
            position: absolute;
            left: 50%;
            top: 2%;
            transform: translateX(-50%);
            resize: both;
            overflow: auto;
            min-width: 600px;
            min-height: 400px;
        }

        .transaction-history-header {
            background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
            padding: 25px 30px;
            border-radius: 12px 12px 0 0;
            color: white;
            position: relative;
        }

        .transaction-history-header h2 {
            margin: 0;
            font-size: 28px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .close-transaction-history {
            position: absolute;
            right: 20px;
            top: 20px;
            color: white;
            font-size: 32px;
            font-weight: bold;
            cursor: pointer;
            transition: opacity 0.2s;
        }

        .close-transaction-history:hover {
            opacity: 0.7;
        }

        .transaction-controls {
            padding: 20px 30px;
            background: #2a2a3e;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .transaction-stats {
            display: flex;
            gap: 30px;
            color: #fff;
        }

        .transaction-stat {
            text-align: center;
        }

        .transaction-stat-label {
            font-size: 11px;
            color: #d1d5db;
            text-transform: uppercase;
        }

        .transaction-stat-value {
            font-size: 20px;
            font-weight: 700;
            color: #f59e0b;
        }

        .download-csv-btn {
            padding: 10px 20px;
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            border: none;
            border-radius: 6px;
            color: white;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: all 0.2s;
            box-shadow: 0 2px 8px rgba(16,185,129,0.3);
        }

        .download-csv-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(16,185,129,0.4);
        }

        .transaction-table-container {
            padding: 30px;
            background: #2a2a3e;
        }

        .transaction-table {
            width: 100%;
            border-collapse: collapse;
            background: #1e1e2e;
            border-radius: 8px;
            overflow: hidden;
        }

        .transaction-table thead {
            background: #2a2a3e;
        }

        .transaction-table th {
            padding: 15px;
            text-align: left;
            color: #e5e7eb;
            font-size: 12px;
            text-transform: uppercase;
            font-weight: 600;
            border-bottom: 2px solid #3a3a4e;
        }

        .transaction-table td {
            padding: 15px;
            color: #f3f4f6;
            border-bottom: 1px solid #2a2a3e;
        }

        .transaction-table tbody tr:hover {
            background: #2a2a3e;
        }

        .transaction-type-buy {
            color: #10b981;
            font-weight: 600;
        }

        .transaction-type-sell {
            color: #ef4444;
            font-weight: 600;
        }


        /* Consistent column widths for both purchase and sold tables */
        .edit-col { width: 40px; text-align: center; }
        .portfolio-col { width: 60px; }
        .name-col { width: 180px; }
        .currency-col { width: 50px; text-align: center; }
        .date-col { width: 100px; }
        .price-col { width: 90px; text-align: right; }
        .shares-col { width: 70px; text-align: right; }
        .current-col { width: 90px; text-align: right; }
        .value-col { width: 100px; text-align: right; }
        .exrate-col { width: 80px; text-align: right; font-size: 11px; }
        .cost-col { width: 80px; text-align: right; }
        .profit-col { width: 100px; text-align: right; font-weight: 600; }
        .percent-col { width: 80px; text-align: right; font-weight: 600; }
        .dividend-col { width: 90px; text-align: right; }
        .actions-col { width: 90px; text-align: center; }

        /* v12.2 - Pie Charts Modal */
        .distribution-modal {
            display: none;
            position: fixed;
            z-index: 10000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.7);
            backdrop-filter: blur(4px);
        }

        .distribution-content {
            background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
            padding: 0;
            border-radius: 15px;
            width: 90%;
            max-width: 1400px;
            max-height: 90vh;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
            /* v15.91 - Draggable & Resizable (like other modals) */
            position: absolute;
            left: 50%;
            top: 20px;
            transform: translateX(-50%);
            resize: both;
            overflow: hidden;
            min-width: 600px;
            min-height: 400px;
            display: flex;
            flex-direction: column;
        }

        .distribution-content #distribution-tab-content {
            flex: 1;
            overflow-y: auto;
        }

        .distribution-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            padding: 25px 30px;
            border-radius: 15px 15px 0 0;
            color: white;
            position: relative;
        }

        .distribution-header h2 {
            margin: 0;
            font-size: 28px;
            font-weight: 700;
        }

        .close-distribution {
            position: absolute;
            right: 20px;
            top: 50%;
            transform: translateY(-50%);
            color: white;
            font-size: 40px;
            font-weight: 300;
            cursor: pointer;
            transition: all 0.2s;
            line-height: 1;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
        }

        .close-distribution:hover {
            background: rgba(255,255,255,0.2);
            transform: translateY(-50%) rotate(90deg);
        }

        .distribution-charts-container {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 40px;
            padding: 40px;
            background: #2a2a3e;
            border-radius: 0 0 15px 15px;
        }

        .distribution-chart-box {
            background: #1e1e2e;
            border: 2px solid #3a3a4e;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.3);
        }

        .distribution-chart-box h3 {
            color: #fff;
            font-size: 24px;
            margin-bottom: 25px;
            text-align: center;
            font-weight: 600;
        }

        .distribution-chart-canvas {
            position: relative;
            height: 600px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        /* v12.0 - Old pie charts section (removed from main page) */
        .charts-container {
            display: none;
        }

        /* v13.0 - Historical Prices Modal */
        .historical-modal {
            display: none;
            position: fixed;
            z-index: 20000; /* v13.6 - Increased from 10000 */
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.9); /* v13.6 - Darker for visibility */
            backdrop-filter: blur(4px);
        }
        
        /* v15.12 - Remove spinner arrows from number inputs */
        input[type=number]::-webkit-inner-spin-button,
        input[type=number]::-webkit-outer-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }
        input[type=number] {
            -moz-appearance: textfield;
        }

        .historical-content {
            background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
            margin: 2% auto;
            padding: 0;
            border-radius: 15px;
            width: 95%;
            max-width: 1600px;
            height: 85vh;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
            animation: modalSlideIn 0.3s ease-out;
            overflow: hidden;
            border: 3px solid #f59e0b;
            display: flex;
            flex-direction: column;
            /* v15.29 - Draggable & Resizable */
            position: absolute;
            left: 50%;
            top: 2%;
            transform: translateX(-50%);
            resize: both;
            min-width: 600px;
            min-height: 400px;
            max-width: 95vw;
            max-height: 95vh;
        }

        .historical-header {
            background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
            padding: 25px 30px;
            border-radius: 15px 15px 0 0;
            color: white;
            flex-shrink: 0; /* v13.7 - Don't shrink header */
            position: relative; /* v13.7 - Changed from sticky */
        }

        .historical-header h2 {
            margin: 0;
            font-size: 28px;
            font-weight: 700;
        }

        .close-historical {
            position: absolute;
            right: 20px;
            top: 50%;
            transform: translateY(-50%);
            color: white;
            font-size: 40px;
            font-weight: 300;
            cursor: pointer;
            transition: all 0.2s;
            line-height: 1;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
        }

        .close-historical:hover {
            background: rgba(255,255,255,0.2);
            transform: translateY(-50%) rotate(90deg);
        }

        .historical-selector {
            padding: 30px;
            background: #2a2a3e;
            flex: 1; /* v13.7 - Take remaining space */
            overflow-y: auto; /* v13.7 - Scroll if needed */
        }

        .historical-stock-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); /* v13.14 - 120px -> 90px (25% smaller) */
            gap: 8px; /* v13.14 - 10px -> 8px */
            background: #1e1e2e;
            padding: 10px; /* v13.6 - Add padding */
        }

        .historical-stock-btn {
            background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
            color: white;
            border: none;
            padding: 8px 10px; /* v13.14 - 10px 12px -> 8px 10px */
            border-radius: 6px; /* v13.14 - 8px -> 6px */
            cursor: pointer;
            font-size: 12px; /* v13.14 - 13px -> 12px */
            font-weight: 600;
            transition: all 0.2s;
            box-shadow: 0 2px 8px rgba(59,130,246,0.3);
            text-align: left;
            border: 2px solid #60a5fa; /* v13.6 - Debug border */
        }

        .historical-stock-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(59,130,246,0.5);
        }

        .historical-stock-btn.loading {
            background: #94a3b8;
            cursor: wait;
        }

        /* v13.14 - Sold stocks style */
        .historical-stock-btn.sold {
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            border-color: #f87171;
            box-shadow: 0 2px 8px rgba(239,68,68,0.3);
        }

        .historical-stock-btn.sold:hover {
            box-shadow: 0 4px 12px rgba(239,68,68,0.5);
        }

        .historical-stock-btn .ticker {
            font-size: 13px; /* v13.14 - 14px -> 13px */
            font-weight: 700;
            margin-bottom: 2px; /* v13.14 - 3px -> 2px */
        }

        .historical-stock-btn .name {
            font-size: 9px; /* v13.14 - 10px -> 9px */
            opacity: 0.9;
            line-height: 1.2;
        }

        .historical-chart-area {
            padding: 30px;
            background: #1e1e2e;
            flex: 1; /* v13.7 - Take remaining space */
            overflow-y: auto; /* v13.7 - Scroll if needed */
            border-radius: 0 0 15px 15px;
        }

        .historical-chart-title {
            color: #fff;
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 20px;
            text-align: center;
        }

        .historical-stats {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 15px;
            margin-bottom: 25px;
        }

        .historical-stat-box {
            background: #2a2a3e;
            padding: 15px;
            border-radius: 10px;
            border: 2px solid #3a3a4e;
        }

        .historical-stat-label {
            font-size: 12px;
            color: #999;
            margin-bottom: 5px;
        }

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

        .historical-chart-container {
            background: #2a2a3e;
            padding: 20px;
            border-radius: 10px;
            border: 2px solid #3a3a4e;
        }

        /* v15.31 - What If Modal Styles */
        .whatif-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.85);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10001;
            animation: whatifFadeIn 0.3s ease;
        }

        @keyframes whatifFadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        .whatif-content {
            background: linear-gradient(145deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
            width: 95%;
            max-width: 1200px;
            max-height: 90vh;
            border-radius: 20px;
            overflow: hidden;
            box-shadow: 0 25px 80px rgba(102, 126, 234, 0.3), 0 0 100px rgba(118, 75, 162, 0.2);
            /* v15.91 - Draggable & Resizable */
            position: absolute;
            left: 50%;
            top: 20px;
            transform: translateX(-50%);
            resize: both;
            min-width: 500px;
            min-height: 400px;
            display: flex;
            flex-direction: column;
        }

        .whatif-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            padding: 25px 30px;
            position: relative;
            overflow: hidden;
            cursor: move;
        }

        .whatif-header::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
            animation: whatifShimmer 3s infinite;
            pointer-events: none;
        }

        @keyframes whatifShimmer {
            0%, 100% { transform: translate(0, 0); }
            50% { transform: translate(25%, 25%); }
        }

        .whatif-header h2 {
            color: white;
            margin: 0;
            font-size: 28px;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 15px;
            position: relative;
            z-index: 1;
        }

        .whatif-header .subtitle {
            color: rgba(255,255,255,0.85);
            font-size: 14px;
            margin-top: 8px;
            position: relative;
            z-index: 1;
        }

        .whatif-close {
            position: absolute;
            top: 20px;
            right: 25px;
            background: rgba(255,255,255,0.2);
            border: none;
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            font-size: 24px;
            cursor: pointer;
            transition: all 0.3s;
            z-index: 2;
        }

        .whatif-close:hover {
            background: rgba(255,255,255,0.3);
            transform: rotate(90deg);
        }

        .whatif-body {
            padding: 30px;
            max-height: calc(90vh - 120px);
            overflow-y: auto;
        }

        .whatif-summary {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 15px;
            margin-bottom: 25px;
        }

        .whatif-summary-card {
            background: linear-gradient(145deg, #2a2a4a 0%, #1e1e3a 100%);
            padding: 15px;
            border-radius: 12px;
            text-align: center;
            border: 1px solid rgba(102, 126, 234, 0.3);
            transition: transform 0.3s, box-shadow 0.3s;
        }

        .whatif-summary-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
        }

        .whatif-summary-card .label {
            color: #a0a0c0;
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 8px;
        }

        .whatif-summary-card .value {
            font-size: 20px;
            font-weight: 700;
            color: white;
        }

        .whatif-summary-card .value.positive { color: #10b981; }
        .whatif-summary-card .value.negative { color: #ef4444; }
        .whatif-summary-card .value.neutral { color: #f59e0b; }

        .whatif-verdict {
            background: linear-gradient(145deg, #1a2a1a 0%, #0f1a0f 100%);
            border: 2px solid #10b981;
            border-radius: 15px;
            padding: 25px;
            margin-bottom: 30px;
            text-align: center;
        }

        .whatif-verdict.bad {
            background: linear-gradient(145deg, #2a1a1a 0%, #1a0f0f 100%);
            border-color: #ef4444;
        }

        .whatif-verdict.neutral {
            background: linear-gradient(145deg, #2a2a1a 0%, #1a1a0f 100%);
            border-color: #f59e0b;
        }

        .whatif-verdict .emoji {
            font-size: 48px;
            margin-bottom: 10px;
        }

        .whatif-verdict .title {
            font-size: 24px;
            font-weight: 700;
            color: white;
            margin-bottom: 5px;
        }

        .whatif-verdict .detail {
            color: #a0a0c0;
            font-size: 14px;
        }

        .whatif-positions-header {
            color: white;
            font-size: 18px;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .whatif-positions {
            display: grid;
            gap: 15px;
        }

        .whatif-position {
            background: linear-gradient(145deg, #252545 0%, #1a1a35 100%);
            border-radius: 12px;
            padding: 20px;
            display: grid;
            grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1.5fr; /* v15.58 - 6 columns for reinvested */
            gap: 15px;
            align-items: center;
            border-left: 4px solid #667eea;
            transition: all 0.3s;
        }

        .whatif-position:hover {
            background: linear-gradient(145deg, #2a2a50 0%, #1e1e3a 100%);
            transform: translateX(5px);
        }

        .whatif-position.winner {
            border-left-color: #10b981;
        }

        .whatif-position.loser {
            border-left-color: #ef4444;
        }

        .whatif-position .stock-info {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .whatif-position .stock-name {
            font-weight: 600;
            color: white;
            font-size: 16px;
        }

        .whatif-position .stock-ticker {
            color: #667eea;
            font-size: 13px;
            font-weight: 500;
        }

        .whatif-position .stock-date {
            color: #6b7280;
            font-size: 12px;
        }

        .whatif-position .col-header {
            font-size: 10px;
            color: #6b7280;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 5px;
        }

        .whatif-position .col-value {
            font-size: 15px;
            font-weight: 600;
            color: white;
        }

        .whatif-position .col-sub {
            font-size: 11px;
            color: #9ca3af;
            margin-top: 3px;
        }

        .whatif-position .result-col .col-value {
            font-size: 18px;
        }

        .whatif-position .result-col .col-value.positive { color: #10b981; }
        .whatif-position .result-col .col-value.negative { color: #ef4444; }

        .whatif-position .verdict-col {
            text-align: center;
        }

        .whatif-position .verdict-badge {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 16px;
            border-radius: 20px;
            font-weight: 600;
            font-size: 13px;
        }

        .whatif-position .verdict-badge.good {
            background: rgba(16, 185, 129, 0.2);
            color: #10b981;
        }

        .whatif-position .verdict-badge.bad {
            background: rgba(239, 68, 68, 0.2);
            color: #ef4444;
        }

        .whatif-position .verdict-badge.neutral {
            background: rgba(245, 158, 11, 0.2);
            color: #f59e0b;
        }

        .whatif-loading {
            text-align: center;
            padding: 60px;
            color: white;
        }

        .whatif-loading .spinner {
            width: 60px;
            height: 60px;
            border: 4px solid rgba(102, 126, 234, 0.3);
            border-top-color: #667eea;
            border-radius: 50%;
            animation: whatifSpin 1s linear infinite;
            margin: 0 auto 20px;
        }

        @keyframes whatifSpin {
            to { transform: rotate(360deg); }
        }

        .whatif-empty {
            text-align: center;
            padding: 60px;
            color: #9ca3af;
        }

        .whatif-empty .icon {
            font-size: 64px;
            margin-bottom: 20px;
            opacity: 0.5;
        }

        .whatif-btn {
            background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 600;
            transition: all 0.3s;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .whatif-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
        }

        /* What If button in sold header */
        .section-header.sold {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .section-header.sold .header-left {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .section-header .whatif-header-btn {
            background: rgba(255,255,255,0.2);
            color: white;
            border: none;
            padding: 6px 14px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 600;
            transition: all 0.3s;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .section-header .whatif-header-btn:hover {
            background: rgba(255,255,255,0.35);
            transform: scale(1.05);
        }

        /* Absolute koersgrafiek (2e grafiek in aandeel-detail/watchlist): vaste-hoogte
           wrapper zodat Chart.js (maintainAspectRatio:false) de hoogte volgt i.p.v. de
           breedte. Op mobiel even hoog als de 1e grafiek (250px). */
        .hist-price-wrap {
            position: relative;
            height: 400px;
        }

        /* v18.40 (US-M02) — vereenvoudigde jaarlijkse breakdown (History → Evolutie):
           enkel Jaar (1), Organisch Rendement EUR (8), Netto % (10). Verberg 2-7, 9,
           Inflatie + FX (11+). Sinds v18.42 twee kostenkolommen (5 aan/verkoop,
           6 bewaarloon) → indexen +1. Aan/uit via de knop ▤ (toggleYearlySimpleView,
           core-prices.js), op laptop én mobiel; zonder keuze aan op mobiel. */
        .pe-yearly-table.simple-view th:nth-child(2),  .pe-yearly-table.simple-view td:nth-child(2),
        .pe-yearly-table.simple-view th:nth-child(3),  .pe-yearly-table.simple-view td:nth-child(3),
        .pe-yearly-table.simple-view th:nth-child(4),  .pe-yearly-table.simple-view td:nth-child(4),
        .pe-yearly-table.simple-view th:nth-child(5),  .pe-yearly-table.simple-view td:nth-child(5),
        .pe-yearly-table.simple-view th:nth-child(6),  .pe-yearly-table.simple-view td:nth-child(6),
        .pe-yearly-table.simple-view th:nth-child(7),  .pe-yearly-table.simple-view td:nth-child(7),
        .pe-yearly-table.simple-view th:nth-child(9),  .pe-yearly-table.simple-view td:nth-child(9),
        .pe-yearly-table.simple-view th:nth-child(n+11), .pe-yearly-table.simple-view td:nth-child(n+11) {
            display: none;
        }
        /* De 3 zichtbare kolommen vullen samen 100% van de breedte */
        .pe-yearly-table.simple-view th:nth-child(1), .pe-yearly-table.simple-view td:nth-child(1) { width: 20%; }
        .pe-yearly-table.simple-view th:nth-child(8), .pe-yearly-table.simple-view td:nth-child(8) { width: 50%; }
        .pe-yearly-table.simple-view th:nth-child(10), .pe-yearly-table.simple-view td:nth-child(10) { width: 30%; }

        /* ───────────────────────────────────────────────────────────────────
           Mobile responsive (US-M01 / US-M02) — desktop layout ongewijzigd
           ─────────────────────────────────────────────────────────────────── */
        @media (max-width: 768px) {
            /* Tweede grafiek (koers) even hoog als de eerste (% rendement = 250px). */
            .hist-price-wrap { height: 250px; }

            /* History modal moet zich aan viewport aanpassen op mobiel, anders
               overflowt de 500px min-width en is mobile CSS binnenin moeilijk te zien. */
            #historyModal .modal-content {
                min-width: 0 !important;
                width: 98% !important;
                max-width: 100% !important;
            }

            /* US-M01: 5 statistiekkaartjes → 2+2+1 grid; kaartje 5 gecentreerd. */
            .portfolio-evolution-stats {
                grid-template-columns: repeat(2, 1fr);
                gap: 10px;
                padding: 14px;
            }
            .portfolio-evolution-stats .pe-stat-box {
                padding: 12px 10px;
            }
            .portfolio-evolution-stats .pe-stat-box:nth-child(5) {
                grid-column: 1 / -1;            /* spans 2 kolommen */
                justify-self: center;            /* horizontaal centreren binnen rij */
                min-width: 55%;
                max-width: 70%;
            }
            .portfolio-evolution-stats .pe-stat-value { font-size: 18px; }
            .portfolio-evolution-stats .pe-stat-label { font-size: 11px; }

            /* US-M02: compactere cellen voor de jaarlijkse breakdown op mobiel. Welke
               kolommen zichtbaar zijn, regelt sinds v18.40 de klasse .simple-view
               (schakelaar ▤, standaard aan op mobiel) — zie buiten deze media query. */
            .pe-yearly-table th, .pe-yearly-table td {
                padding: 8px 6px !important;
                font-size: 12px !important;
            }

            /* Mobile modal fixes — alle modal-content klassen hebben op desktop
               min-width: 400–600px + resize:both. Op een 375px-smartphone overflowt
               dat de viewport, waardoor swipes de onderliggende hoofdpagina
               horizontaal scrollden i.p.v. binnen de modal te blijven. Generaliseert
               de v17.11 .historical-content fix naar alle modals (v17.12). */
            .modal,
            .distribution-modal,
            .portfolio-evolution-modal,
            .transaction-history-modal,
            .whatif-modal,
            .historical-modal {
                overflow: hidden;
            }
            .modal-content,
            .distribution-content,
            .portfolio-evolution-content,
            .transaction-history-content,
            .whatif-content,
            .historical-content {
                min-width: 0 !important;
                width: 98% !important;
                max-width: 100% !important;
                max-height: 95vh !important;
                resize: none !important;
            }
            .modal-content::after,
            .distribution-content::after,
            .portfolio-evolution-content::after,
            .transaction-history-content::after,
            .whatif-content::after,
            .historical-content::after {
                display: none;
            }

            /* US-M03 (v17.18) — Modal tab-strips swipe-scrollbaar op mobiel.
               Strategy modal heeft 5 tabs, History modal 7. Op een 375px viewport
               vallen er telkens ~3 in beeld. Geen flex-wrap (zou alle tabs in 2-3
               rijen forceren en flink verticale ruimte vreten); wel overflow-x:auto
               met touch-momentum en verborgen scrollbar. Een ::after gradient hint
               dat er rechts nog meer tabs zijn. */
            .modal-tab-strip {
                overflow-x: auto;
                flex-wrap: nowrap !important;        /* overrulet History's inline flex-wrap:wrap */
                -webkit-overflow-scrolling: touch;
                scrollbar-width: none;                /* Firefox */
            }
            .modal-tab-strip::-webkit-scrollbar { display: none; }  /* Chrome/Safari */
            .modal-tab-strip > button {
                flex-shrink: 0;                       /* tabs behouden hun breedte */
            }
            .modal-tab-strip-wrap {
                position: relative;
            }
            .modal-tab-strip-wrap::after {
                content: '';
                position: absolute;
                top: 0; right: 0; bottom: 0;
                width: 40px;
                background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,1));
                pointer-events: none;                 /* fade onderschept geen taps */
            }
        }


