/* --- Design System / Variables --- */
:root {
    --bg-main: #0B0E14;
    --bg-sidebar: #07090D;
    --bg-card: rgba(16, 22, 33, 0.7);
    --bg-card-hover: rgba(22, 31, 46, 0.8);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-color-glow: rgba(0, 229, 255, 0.15);
    
    --text-primary: #F0F4F8;
    --text-secondary: #8E9BAE;
    --text-muted: #5D6B7E;
    
    --color-primary: #00E5FF;
    --color-primary-rgb: 0, 229, 255;
    --color-secondary: #7000FF;
    
    --color-green: #00E676;
    --color-orange: #FF9100;
    --color-red: #FF1744;
    --color-blue: #2979FF;
    --color-purple: #D500F9;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-fast: all 0.15s ease;
}

/* --- Global Reset & Styles --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* --- Layout --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 40px;
    min-height: 100vh;
}

/* --- Sidebar --- */
.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-icon {
    font-size: 24px;
    color: var(--color-primary);
    text-shadow: 0 0 10px rgba(var(--color-primary-rgb), 0.3);
}

.logo-area h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-area h2 span {
    color: var(--color-primary);
}

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

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background-color: rgba(var(--color-primary-rgb), 0.08);
    color: var(--color-primary);
    border: 1px solid rgba(var(--color-primary-rgb), 0.15);
}

.sidebar-footer {
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* --- Main Header --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
}

.main-header h1 {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.8px;
    background: linear-gradient(135deg, #FFF, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.time-stamp {
    font-size: 11px;
    color: var(--text-muted);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-smooth);
}

.btn-primary {
    background-color: var(--color-primary);
    color: #07090D;
    box-shadow: 0 4px 15px rgba(var(--color-primary-rgb), 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--color-primary-rgb), 0.4);
    background-color: #33ebff;
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--text-secondary);
}

.btn-danger {
    background-color: rgba(255, 23, 68, 0.1);
    color: var(--color-red);
    border-color: rgba(255, 23, 68, 0.2);
}

.btn-danger:hover {
    background-color: var(--color-red);
    color: #FFF;
    box-shadow: 0 4px 15px rgba(255, 23, 68, 0.3);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 6px;
}

/* --- Cards / Glassmorphism --- */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: var(--transition-smooth);
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-glow);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* --- Summary Cards --- */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.summary-card .card-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.card-blue .card-icon {
    background-color: rgba(41, 121, 255, 0.1);
    color: var(--color-blue);
    border: 1px solid rgba(41, 121, 255, 0.2);
}

.card-green .card-icon {
    background-color: rgba(0, 230, 118, 0.1);
    color: var(--color-green);
    border: 1px solid rgba(0, 230, 118, 0.2);
}

.card-purple .card-icon {
    background-color: rgba(213, 0, 249, 0.1);
    color: var(--color-purple);
    border: 1px solid rgba(213, 0, 249, 0.2);
}

.card-orange .card-icon {
    background-color: rgba(255, 145, 0, 0.1);
    color: var(--color-orange);
    border: 1px solid rgba(255, 145, 0, 0.2);
}

.card-cyan .card-icon {
    background-color: rgba(0, 229, 255, 0.1);
    color: var(--color-primary);
    border: 1px solid rgba(0, 229, 255, 0.2);
}


.summary-card h3 {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.summary-card .value {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.summary-card .subtext {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Grid & Layout Sections --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
}

.grid-col-full {
    grid-column: span 12;
}

.grid-col-half {
    grid-column: span 6;
}

@media (max-width: 1100px) {
    .grid-col-half {
        grid-column: span 12;
    }
}

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

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 i {
    color: var(--color-primary);
}

/* --- Certificate Cards Grid --- */
.certificates-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.cert-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    transition: var(--transition-smooth);
}

.cert-card:hover {
    border-color: var(--border-color-glow);
    background: var(--bg-card-hover);
}

.cert-card:target, .cert-card.highlight-glow {
    animation: highlight-glow 2.5s ease-out;
    border-color: var(--color-primary);
    box-shadow: 0 0 25px rgba(var(--color-primary-rgb), 0.25);
    scroll-margin-top: 20px;
}

@keyframes highlight-glow {
    0% {
        box-shadow: 0 0 35px rgba(var(--color-primary-rgb), 0.7);
        border-color: var(--color-primary);
        background: rgba(var(--color-primary-rgb), 0.05);
    }
    50% {
        box-shadow: 0 0 25px rgba(var(--color-primary-rgb), 0.4);
    }
    100% {
        box-shadow: none;
        border-color: var(--border-color);
        background: var(--bg-card);
    }
}

.cert-isin-link {
    text-decoration: none;
    cursor: pointer;
    display: inline-block;
    transition: var(--transition-fast);
}

.cert-isin-link:hover .cert-isin-tag {
    color: #FFF;
    text-shadow: 0 0 8px rgba(var(--color-primary-rgb), 0.6);
}


.cert-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.cert-title-area {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cert-isin-tag {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: 0.5px;
}

.cert-category {
    font-size: 15px;
    font-weight: 500;
}

.cert-meta-info {
    display: flex;
    gap: 20px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.cert-meta-info span i {
    margin-right: 4px;
    color: var(--text-muted);
}

.cert-actions {
    display: flex;
    gap: 10px;
}

/* --- Table styling --- */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

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

.table th {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

/* --- Underlyings Detail in Cert --- */
.underlying-row td {
    vertical-align: middle;
}

.underlying-name {
    font-weight: 600;
    color: #FFF;
}

.underlying-ticker-badge {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: monospace;
    margin-left: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.underlying-ticker-badge:hover {
    background-color: rgba(0, 229, 255, 0.1);
    color: var(--color-primary);
}

/* --- Distances and Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background-color: rgba(0, 230, 118, 0.1);
    color: var(--color-green);
    border: 1px solid rgba(0, 230, 118, 0.2);
}

.badge-warning {
    background-color: rgba(255, 145, 0, 0.1);
    color: var(--color-orange);
    border: 1px solid rgba(255, 145, 0, 0.2);
}

.badge-danger {
    background-color: rgba(255, 23, 68, 0.1);
    color: var(--color-red);
    border: 1px solid rgba(255, 23, 68, 0.2);
}

.badge-info {
    background-color: rgba(41, 121, 255, 0.1);
    color: var(--color-blue);
    border: 1px solid rgba(41, 121, 255, 0.2);
}

.badge-muted {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-watchlist {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(107, 33, 168, 0.15));
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.1);
}

.percentage-bar-container {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.05);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.percentage-bar {
    height: 100%;
    border-radius: 3px;
}

/* --- Mini Tables inside column cards --- */
.col-card {
    height: 100%;
}

.col-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.col-card .card-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.table-minimal th {
    color: var(--text-secondary);
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
}

.table-minimal td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table-minimal tbody tr:last-child td {
    border-bottom: none;
}

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 14px;
}

/* --- Modals --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(3, 4, 6, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: #0E121B;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-lg {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.1);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

/* --- Form elements --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input, 
.form-group select {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    transition: var(--transition-fast);
}

.form-group input:focus, 
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.1);
}

.form-group small {
    font-size: 11px;
    color: var(--text-muted);
}

.form-row {
    display: flex;
    gap: 16px;
}

.col-6 {
    flex: 0 0 calc(50% - 8px);
}

.form-divider {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(var(--color-primary-rgb), 0.2);
    padding-bottom: 4px;
    margin: 20px 0 16px 0;
}

.underlying-edit-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.underlying-edit-row .asset-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
}

.underlying-edit-row .input-ticker {
    width: 180px;
}

.text-muted {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
}

/* --- Background Refresh Indicator --- */
.refresh-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(0, 229, 255, 0.08);
    color: var(--color-primary);
    border: 1px solid rgba(0, 229, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 12px;
    animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.2);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(0, 229, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 229, 255, 0);
    }
}

/* --- Certificate Select Dropdown Styling --- */
.cert-select-view {
    width: 320px;
    background: rgba(16, 22, 33, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 16px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    outline: none;
}

.cert-select-view:focus, .cert-select-view:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.1);
}

.cert-select-view option {
    background-color: var(--bg-main);
    color: var(--text-primary);
    padding: 10px;
}

/* --- Utility Alignments & Colors --- */
.text-right {
    text-align: right;
}
.text-center {
    text-align: center;
}
.text-success {
    color: var(--color-green) !important;
}
.text-danger {
    color: var(--color-red) !important;
}
.text-warning {
    color: var(--color-orange) !important;
}

/* --- Toggle Switch Closed Positions --- */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.toggle-container:hover {
    border-color: rgba(0, 229, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.toggle-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    user-select: none;
    letter-spacing: 0.2px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .3s;
}

input:checked + .slider {
    background-color: rgba(0, 229, 255, 0.15);
    border-color: var(--color-primary);
}

input:checked + .slider:before {
    background-color: var(--color-primary);
    transform: translateX(18px);
}

.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- Mobile Top Navigation Bar (Default Hidden) --- */
.mobile-nav-bar {
    display: none;
}

.sidebar-overlay {
    display: none;
}

/* --- Responsive Media Queries --- */
@media (max-width: 768px) {
    .mobile-nav-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
        background-color: var(--bg-sidebar);
        border-bottom: 1px solid var(--border-color);
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1010; /* Above sidebar drawer but below modal overlays */
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .btn-toggle-sidebar {
        background: transparent;
        border: 1px solid var(--border-color);
        color: var(--color-primary);
        font-size: 20px;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: var(--transition-fast);
    }
    
    .btn-toggle-sidebar:hover {
        border-color: var(--color-primary);
        box-shadow: 0 0 10px rgba(var(--color-primary-rgb), 0.2);
    }
    
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition-smooth);
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1020; /* Above mobile top nav bar */
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1015; /* Between mobile top nav and sidebar drawer */
        transition: opacity 0.3s ease;
        display: none;
    }
    
    .sidebar-overlay.open {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding: 84px 16px 40px 16px; /* Top padding to accommodate fixed mobile nav bar */
    }
    
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .header-actions {
        align-items: flex-start;
        width: 100%;
    }
    
    .summary-cards {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
        margin-bottom: 24px;
    }
    
    .summary-card {
        padding: 16px;
        gap: 12px;
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
    
    .summary-card .card-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
        border-radius: 10px;
    }
    
    .summary-card .value {
        font-size: 20px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .section-header div {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Tables responsiveness adjustments */
    .table th, .table td {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .cert-card .card-body {
        padding: 16px;
    }
    
    .cert-card-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cert-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 12px;
    }
    
    .cert-actions .btn {
        flex: 1 1 auto;
    }
    
    .cert-meta-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .col-6 {
        width: 100% !important;
        flex: none;
    }
}
/* --- Alerts Panel & Cards --- */
.alerts-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.alert-card {
    background: rgba(16, 22, 33, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.alert-card:hover {
    transform: translateY(-2px);
    background: rgba(16, 22, 33, 0.75);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
}

.alert-card.alert-breached {
    border-left: 5px solid var(--color-red);
}

.alert-card.alert-danger-zone {
    border-left: 5px solid var(--color-orange);
}

.alert-card.alert-autocall-imminent {
    border-left: 5px solid var(--color-primary);
}

.alert-card-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.alert-card-icon {
    font-size: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-breached .alert-card-icon {
    background-color: rgba(255, 23, 68, 0.1);
    color: var(--color-red);
    animation: pulse-red 2s infinite;
}

.alert-danger-zone .alert-card-icon {
    background-color: rgba(255, 145, 0, 0.1);
    color: var(--color-orange);
    animation: pulse-orange 2s infinite;
}

.alert-autocall-imminent .alert-card-icon {
    background-color: rgba(0, 229, 255, 0.1);
    color: var(--color-primary);
    animation: pulse-cyan 2s infinite;
}

.alert-card-text {
    flex: 1;
}

.alert-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.alert-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.alert-card-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-alert-link {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--color-primary);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-alert-link:hover {
    background-color: rgba(0, 229, 255, 0.1);
    border-color: var(--color-primary);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 23, 68, 0.3);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(255, 23, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 23, 68, 0);
    }
}

@keyframes pulse-orange {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 145, 0, 0.3);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(255, 145, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 145, 0, 0);
    }
}

@keyframes pulse-cyan {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.3);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(0, 229, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 229, 255, 0);
    }
}

/* Mobile responsive for alerts */
@media (max-width: 576px) {
    .alert-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .alert-card-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .btn-alert-link {
        width: 100%;
        justify-content: center;
    }
}

/* Sticky ISIN column in Open Positions table */
#table-open-positions {
    border-collapse: separate;
    border-spacing: 0;
}

#table-open-positions th:first-child,
#table-open-positions td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: #101621 !important; /* Base card color to cover overlapping scrolled content */
    border-right: 2px solid var(--border-color);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.3);
}

#table-open-positions tr:hover td:first-child {
    background-color: #161f2e !important; /* Highlight on hover */
}

/* --- Analytics & Statistics Styling --- */
#analytics-section .col-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    transition: var(--transition-smooth);
    overflow: hidden;
}

#analytics-section .col-card:hover {
    border-color: var(--border-color-glow);
    background: var(--bg-card-hover);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#analytics-section .table th {
    font-family: var(--font-heading);
    font-size: 13px;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

#analytics-section .table td {
    font-size: 14px;
    padding: 14px 16px;
    vertical-align: middle;
}

#analytics-section .table tr {
    transition: var(--transition-fast);
}

#analytics-section .table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

