﻿        /* Base page styling */
        body {
            font-family: Arial, sans-serif;
            font-size: 16px;
            line-height: 1.6;
            margin: 20px;
            background-color: #f4f4f4;
            color: #333;
        }

        .container {
            max-width: 1280px;
            margin: 30px auto;
            background-color: #fff;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        }

        /* Headings hierarchy */
        h1 {
            font-size: 2.2em;
            font-weight: 700;
            color: #2c3e50;
            text-align: center;
            margin-bottom: 25px;
        }

        h2 {
            font-size: 1.6em;
            font-weight: 600;
            color: #2c3e50;
            text-align: center;
            margin-bottom: 20px;
        }

        h3 {
            font-size: 1.2em;
            font-weight: 600;
            color: #34495e;
            border-bottom: 1px solid #bdc3c7;
            padding-bottom: 10px;
            margin-bottom: 15px;
        }

        /* Paragraphs & lists */
        p {
            font-weight: 400;
            margin-bottom: 15px;
        }

        ul,
        ol {
            margin: 0 0 15px 20px;
            padding: 0;
        }

        li {
            margin-bottom: 6px;
        }

        /* Section blocks */
        .section {
            background-color: #f8f9f9;
            padding: 20px;
            border-radius: 6px;
            margin-bottom: 20px;
            border: 1px solid #ddd;
        }

        .section h3 {
            margin-top: 0;
        }

        /* Tables */
        table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
            border-radius: 8px;
            overflow: hidden;
        }

        th,
        td {
            border: 1px solid #ddd;
            padding: 10px;
            text-align: left;
            font-size: 0.9em;
        }

        th {
            background-color: #2980b9;
            color: white;
        }

        /* Forced zebra striping to override inline styles */
        table tr:nth-child(even) {
            background-color: #e9f1f8 !important;
        }

        td:first-child {
            font-weight: bold;
        }

        input[type="number"] {
            width: 60px;
            padding: 5px;
            border: 1px solid #ccc;
            border-radius: 4px;
            text-align: right;
            font-size: 18px;
            /* Hide spinners */
            -moz-appearance: textfield;
        }
        input[type="number"]::-webkit-outer-spin-button,
        input[type="number"]::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }

        /* Buttons */
        button {
            background-color: #27ae60;
            color: white;
            padding: 10px 15px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 20px;
            margin-right: 10px;
        }

        button:hover {
            background-color: #219d53;
        }

        button:disabled {
            background-color: #95a5a6;
            cursor: not-allowed;
        }

        .controls {
            text-align: center;
            margin-bottom: 25px;
        }

        /* Grid Layout */
        .grid-layout {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 15px;
            margin-bottom: 30px;
        }

        /* Summary box */
        .summary-box {
            background-color: #2980b9 !important;
            border: 1px solid #1f6d93;
            padding: 15px;
            border-radius: 6px;
        }

        .summary-title {
            color: #ffffff !important;
            margin: 0 0 14px;
            font-size: 20px;
            font-weight: 700;
        }

        .summary-sub {
            color: #ffffff !important;
            font-style: italic;
            font-weight: 600;
        }

        .summary-cards {
            display: grid;
            grid-template-columns: 0.75fr 1.34fr 1fr;
            gap: 14px;
            margin-top: 12px;
        }

        .card {
            background: #e9f1f8;
            border: 1px solid #d4dee8;
            border-radius: 10px;
            padding: 16px;
            text-align: center;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
        }

        .card-label {
            font-size: 18px;
            color: #666;
            margin-bottom: 8px;
            text-transform: uppercase;
            letter-spacing: .04em;
        }

        .card-value {
            font-size: 24px;
            font-weight: 800;
            color: #2c3e50;
            margin-bottom: 0;
            font-variant-numeric: tabular-nums;
        }

        .alloc-block {
            text-align: left;
        }

        .alloc-label {
            font-size: 18px;
            color: #666;
            text-transform: uppercase;
            letter-spacing: .04em;
            margin-bottom: 8px;
        }

        .alloc-row {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .bar-wrap {
            background: #eee;
            border-radius: 8px;
            height: 14px;
            width: 100%;
            overflow: hidden;
            flex: 1 1 auto;
        }

        .bar-fill {
            height: 14px;
            background: #27ae60;
            width: 0%;
            transition: width .35s ease;
        }

        .cash-remaining {
            font-size: 18px;
            font-weight: 700;
            color: #2c3e50;
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
        }

        .cash-remaining.neg {
            color: #c0392b;
            font-size: 24px;
        }

        /* Instructions toggle */
        .instructions-details {
            border: none;
            background: transparent;
            padding: 0;
        }

        .instructions-summary {
            display: inline-block;
            background-color: #27ae60;
            color: #fff;
            font-weight: 700;
            padding: 8px 12px;
            border-radius: 6px;
            border: none;
            cursor: pointer;
            margin: 0;
            list-style: none;
        }

        .instructions-summary::-webkit-details-marker {
            display: none;
        }

        .instructions-summary:hover {
            background-color: #219d53;
        }

        .instructions-details[open] .instructions-summary {
            border-bottom-left-radius: 0;
            border-bottom-right-radius: 0;
        }

        .instructions-content {
            background: #fff;
            border: 1px solid #e0e0e0;
            border-top: none;
            border-radius: 0 6px 6px 6px;
            padding: 12px 14px;
            line-height: 1.55;
        }

        .instructions-content ul {
            margin-left: 22px;
        }

        .instructions-content li {
            margin: 6px 0;
        }

        /* Hero section */
        .hero {
            position: relative;
            border-radius: 10px;
            overflow: hidden;
            min-height: 300px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            align-items: flex-start;
            padding: 24px 28px;
            margin-bottom: 22px;
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
            background: #0b2536;
            transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .hero.slim,
        .hero.metrics-mode {
            min-height: 100px;
            justify-content: center;
            margin-bottom: 2px;
        }

        .hero.slim::before,
        .hero.metrics-mode::before {
            filter: blur(5px) brightness(0.6);
        }

        .hero.metrics-mode {
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            padding: 10px 40px;
            min-height: 80px;
            background: #061726;
            /* Darker fintech background */
        }

        .hero-metrics-content {
            display: none;
            /* Hidden by default */
            z-index: 2;
            gap: 40px;
        }

        .hero.metrics-mode .hero-metrics-content {
            display: flex;
        }

        .hero.metrics-mode .hero-title {
            font-size: 22px;
            margin-right: auto;
        }

        .hero.metrics-mode .hero-tagline {
            display: none;
        }

        .header-metric {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: white;
        }

        .h-metric-label {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: rgba(255, 255, 255, 0.6);
            margin-bottom: 2px;
        }

        .h-metric-value {
            font-size: 22px;
            font-weight: 700;
            color: #4ade80;
            /* Success green for values */
            font-family: 'Courier New', monospace;
            /* Professional data look */
        }

        .hero::before {
            content: "";
            position: absolute;
            inset: 0;
            background-image: url('https://3787757.fs1.hubspotusercontent-na1.net/hubfs/3787757/CORE100%20Business%20Fundamentals%20Course/PortfolioBackdrop3.png');
            background-size: cover;
            background-position: top center;
            transform: none;
            transition: filter 0.5s ease, brightness 0.5s ease;
        }


        .hero::after {
            content: "";
            position: absolute;
            inset: 0;
            background: linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.45) 70%, rgba(0, 0, 0, 0.55));
        }

        .hero-title {
            position: relative;
            z-index: 1;
            color: #f2f6ff;
            font-size: 36px;
            font-weight: 800;
            line-height: 1.1;
            margin: 0;
            text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
            letter-spacing: .2px;
            transition: font-size 0.5s ease;
        }

        .hero.slim .hero-title {
            font-size: 24px;
        }


        .hero-tagline {
            position: relative;
            z-index: 1;
            color: rgba(255, 255, 255, 0.95);
            font-size: 16px;
            font-weight: 600;
            margin: 0;
            text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
            letter-spacing: .3px;
            width: 33%;
            text-align: left;
            align-self: flex-start;
            line-height: 1.4;
            transition: opacity 0.4s ease, max-height 0.4s ease, margin 0.4s ease;
            overflow: hidden;
        }

        .hero.slim .hero-tagline {
            opacity: 0;
            max-height: 0;
            margin: 0;
            pointer-events: none;
        }


        /* Hidden elements */
        #fileInput {
            display: none;
        }

        /* Sticky Header Logic */
        .app-header-sticky {
            position: sticky;
            top: 0;
            z-index: 1000;
            background-color: #fff;
            padding-top: 10px;
            /* Space for the container shadow */
            margin-top: -30px;
            /* Offset the container margin */
            margin-left: -30px;
            margin-right: -30px;
            padding-left: 30px;
            padding-right: 30px;
            padding-bottom: 10px;
            border-bottom: 1px solid #eee;
        }

        .sticky-sub-header {
            position: sticky;
            top: 155px;
            /* Hero (~100px) + Nav (~50px) + padding */
            z-index: 999;
            background-color: #fff;
            padding-bottom: 10px;
            margin-bottom: 15px;
            border-bottom: 1px solid #eee;
        }

        /* Navigation and Section Management */
        .hidden {
            display: none !important;
        }

        .nav-container {
            background-color: #2c3e50;
            padding: 0;
            margin: 0;
            border-radius: 0 0 8px 8px;
        }

        .nav-tabs {
            display: flex;
            list-style: none;
            margin: 0;
            padding: 0;
            background-color: #34495e;
        }

        .nav-tab {
            flex: 1;
        }

        .nav-tab button {
            width: 100%;
            background-color: transparent;
            color: #ecf0f1;
            border: none;
            padding: 15px 20px;
            cursor: pointer;
            font-size: 18px;
            font-weight: 600;
            transition: all 0.3s ease;
            border-bottom: 3px solid transparent;
        }

        .nav-tab button:hover {
            background-color: #3498db;
            color: white;
        }

        .nav-tab button.active {
            background-color: #2980b9;
            color: white;
            border-bottom-color: #27ae60;
        }

        .nav-tab button:first-child {
            border-radius: 0 0 0 8px;
        }

        .nav-tab button:last-child {
            border-radius: 0 0 8px 0;
        }

        /* Section styling */
        .app-section {
            min-height: 400px;
            padding: 20px;
        }

        .section-header {
            text-align: center;
            margin-bottom: 10px;
            padding-bottom: 0px;
            border-bottom: none;
        }

        .section-header h2 {
            color: #2c3e50;
            margin: 0;
            font-size: 2em;
        }

        .section-header p {
            color: #7f8c8d;
            margin: 10px 0 0 0;
            font-style: italic;
            font-size: 22px;
        }

        /* Dashboard specific styles */
        .dashboard-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            margin-bottom: 30px;
        }

        /* Performance Dashboard Styles */
        .performance-dashboard {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 12px;
            padding: 25px;
            margin-bottom: 30px;
            color: white;
        }

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

        .metric-card {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 8px;
            padding: 20px;
            display: flex;
            align-items: center;
            gap: 15px;
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        .metric-icon {
            font-size: 2.2em;
            opacity: 0.9;
        }

        .metric-content {
            flex: 1;
        }

        .metric-label {
            font-size: 1.0em;
            opacity: 0.8;
            margin-bottom: 5px;
        }

        .metric-value {
            font-size: 1.7em;
            font-weight: 700;
            margin-bottom: 5px;
        }

        .metric-change {
            font-size: 0.9em;
            font-weight: 600;
        }

        .metric-change.positive {
            color: #4ade80;
        }

        .metric-change.negative {
            color: #f87171;
        }

        /* Charts Section */
        .charts-section {
            display: block;
            margin-bottom: 30px;
            max-width: 100%;
        }

        .chart-container {
            background: white;
            border-radius: 12px;
            padding: 20px;
            padding-bottom: 40px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            border: 1px solid #e5e7eb;
            min-width: 0;
            /* Allow grid item to shrink */
        }

        .chart-container h3 {
            margin: 0 0 20px 0;
            color: #374151;
            font-size: 1.4em;
        }

        /* Responsive charts */
        .chart-container canvas {
            max-width: 100%;
            height: auto;
        }

        /* Portfolio value chart */
        #portfolioValueChart {
            width: 100%;
            max-width: 100%;
        }

        /* Allocation chart */
        #allocationChart {
            width: 100%;
            max-width: 100%;
        }

        /* Analytics Section */
        .analytics-section {
            margin-bottom: 30px;
        }

        .analytics-section h3 {
            color: #374151;
            margin-bottom: 20px;
            font-size: 1.7em;
        }

        .analytics-grid {
            display: block;
        }

        .analytics-card {
            background: white;
            border-radius: 8px;
            padding: 20px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            border: 1px solid #e5e7eb;
            margin-bottom: 30px;
        }

        .analytics-card h4 {
            margin: 0 0 15px 0;
            color: #374151;
            font-size: 1.3em;
            border-bottom: 2px solid #f3f4f6;
            padding-bottom: 10px;
        }

        /* Detailed History */
        .detailed-history {
            margin-top: 30px;
        }

        .detailed-history h3 {
            color: #374151;
            margin-bottom: 20px;
            font-size: 1.7em;
        }

        .dashboard-card {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 25px;
            border-radius: 12px;
            text-align: center;
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
        }

        .dashboard-card h3 {
            margin: 0 0 15px 0;
            font-size: 1.5em;
            font-weight: 600;
            color: white;
        }

        .dashboard-card .value {
            font-size: 2.4em;
            font-weight: 800;
            margin: 10px 0;
        }

        .dashboard-card .label {
            font-size: 1.1em;
            opacity: 0.9;
            margin: 5px 0;
        }

        .continue-button {
            background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
            color: white;
            border: none;
            padding: 15px 30px;
            border-radius: 8px;
            font-size: 20px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
        }

        .continue-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
        }

        /* History section styles */
        .history-placeholder {
            background-color: #f8f9fa;
            border: 2px dashed #dee2e6;
            border-radius: 8px;
            padding: 40px;
            text-align: center;
            color: #6c757d;
        }

        .history-placeholder h3 {
            margin: 0 0 15px 0;
            color: #495057;
        }


        /* Portfolio history report */
        .report-summary-table {
            width: 100%;
            margin-bottom: 20px;
        }

        .report-summary-table td {
            border: none;
            padding: 5px 10px;
        }

        .report-summary-table .label {
            font-weight: bold;
            padding-right: 20px;
        }

        .report-summary-table .value {
            font-weight: bold;
            color: #2c3e50;
        }

        .report-summary-table .percent {
            color: #27ae60;
            font-weight: bold;
        }

        /* Company Card - Stacked Row Layout */
        .company-card {
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            border: 1px solid #cbd5e1;
            overflow: hidden;
            transition: transform 0.2s, box-shadow 0.2s;
            display: flex;
            flex-direction: column;
            margin-bottom: 0px;
        }

        .company-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
        }

        .card-header {
            padding: 16px 24px;
            border-bottom: 1px solid #e2e8f0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: #f1f5f9;
        }

        .company-name {
            display: flex;
            align-items: center;
            gap: 10px;
            font-weight: 700;
            font-size: 1.4em;
            color: #0f172a;
        }

        .company-icon {
            width: 42px;
            height: 42px;
            border-radius: 8px;
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 20px;
        }

        .rating-badge {
            font-size: 1.1em;
            padding: 4px 8px;
            border-radius: 6px;
            font-weight: 600;
            background: #e2e8f0;
            color: #475569;
        }

        .rating-A {
            background: #dcfce7;
            color: #166534;
        }

        .rating-B {
            background: #e0f2fe;
            color: #075985;
        }

        .rating-C {
            background: #ffedd5;
            color: #9a3412;
        }

        .rating-D {
            background: #fee2e2;
            color: #991b1b;
        }

        .card-body {
            padding: 0;
            display: flex;
            flex-direction: column;
        }

        .section-stock {
            background: #e0f2fe;
            padding: 10px 15px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid #bae6fd;
        }

        .section-bond {
            background: #fffbeb;
            padding: 10px 15px;
            display: flex;
            flex-direction: column;
            gap: 0;
        }

        .bond-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 0;
            border-bottom: 1px solid rgba(0, 0, 0, 0.05);
            font-size: 18px;
        }

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

        /* Inputs */
        .action-group {
            display: flex;
            align-items: center;
            gap: 12px;
            min-width: 160px;
            justify-content: flex-end;
        }

        input[type="number"] {
            width: 100px;
            padding: 8px;
            border: 1px solid #94a3b8;
            border-radius: 4px;
            font-size: 21px;
            text-align: right;
            display: block;
            background: white;
        }

        input[type="number"]:focus {
            outline: none;
            border-color: #2563eb;
            box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
        }

        .cost-display {
            font-size: 21px;
            font-weight: 600;
            color: #64748b;
            margin-left: 12px;
            min-width: 90px;
            text-align: right;
        }