/* General Layout & Typography */
.bq-estimates-main-header h1 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: #111827; 
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.bq-estimates-main-header p {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #6b7280; 
    margin-bottom: 32px;
}

.bq-est-block {
    margin-bottom: 40px;
    background: #ffffff;
    border: 1px solid #eeeeee;
    border-radius: 6px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.bq-est-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 16px;
}

.bq-est-header h2 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    color: #374151;
    letter-spacing: 0.05em;
}

/* Modern Segmented Control Toggle */
.bq-est-toggle {
    display: inline-flex;
    background: #f3f4f6;
    padding: 3px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.est-toggle-input {
    display: none;
}

.bq-est-toggle label {
    padding: 5px 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    user-select: none;
}

.est-toggle-input:checked + label {
    background: #ffffff;
    color: #111827;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Charts */
.bq-est-chart-container {
    position: relative;
    height: 360px;
    width: 100%;
    margin-bottom: 30px;
}

/* --- ENTERPRISE TABLE STYLES --- */
.bq-est-table-wrapper {
    overflow-x: auto;
    border-top: 1px solid #e5e7eb;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.bq-est-wide-table {
    width: 100%;
    border-collapse: separate; 
    border-spacing: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 
    font-size: 13px;
    color: #333;
}

/* Cells */
.bq-est-wide-table th, 
.bq-est-wide-table td {
    padding: 6px 16px; /* Comfortable spacing */
    border-bottom: 1px solid #e5e7eb;
    text-align: right;
    white-space: nowrap;
    min-width: 90px;
    /* Tabular numbers for alignment */
    font-feature-settings: "tnum"; 
    font-variant-numeric: tabular-nums;
}

/* Table Head */
.bq-est-wide-table thead th {
    background: #f9fafb; /* Light gray */
    color: #5f6368;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    z-index: 5;
    border-bottom: 1px solid #d1d5db; /* Slightly darker border for separation */
}

/* Sticky First Column (Metric Name) */
.bq-est-wide-table .fixed-col {
    position: sticky;
    left: 0;
    z-index: 6;
    background: #ffffff;
    text-align: left;
    min-width: 180px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: 600;
    color: #111827;
    /* Distinct separation line */
    border-right: 1px solid #d1d5db; 
}

.bq-est-wide-table thead .fixed-col {
    z-index: 7;
    background: #f9fafb;
    color: #374151;
}

/* Hover Effects */
.bq-est-wide-table tr:hover td {
    background-color: #f8fafc; /* Slate 50 */
}
.bq-est-wide-table tr:hover .fixed-col {
    background-color: #f8fafc;
}

/* Consensus Row Highlighting */
.highlight-row-bg td, 
.highlight-row-bg .fixed-col {
    background-color: #fffbeb; /* Amber 50 - Very subtle warmth */
    color: #000;
}

.bq-est-wide-table tr.highlight-row-bg:hover td,
.bq-est-wide-table tr.highlight-row-bg:hover .fixed-col {
    background-color: #fef3c7; /* Amber 100 on hover */
}

/* Scroll To Top */
#bq-scroll-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    background-color: #1f2937;
    color: white;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

#bq-scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

#bq-scroll-to-top:hover {
    background-color: #111827;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .bq-est-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .bq-est-toggle {
        width: 100%;
    }
    .bq-est-toggle label {
        flex: 1;
        text-align: center;
    }
}