:root {
    /* Color System */
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #3b82f6;
    --accent-dark: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --surface: #ffffff;
    --background: #f1f5f9;
    --border: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    /* Pillar Colors */
    --color-safety: #ef4444;
    --color-compliance: #f59e0b;
    --color-ops: #3b82f6;
    --color-financial: #10b981;

    /* Layout */
    --header-height: 60px;
    --sidebar-width: 340px;
    --content-max-width: 1400px;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Typography */
    --font-main: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--background);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

/* --- UTILITIES --- */
.text-accent {
    color: var(--accent);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.text-muted {
    color: var(--text-muted);
}

.font-bold {
    font-weight: 700;
}

.trend-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--background);
    color: var(--text-muted);
}

.trend-badge.trend-up {
    background: #ecfdf5;
    color: #059669;
}

.trend-badge.trend-down {
    background: #fef2f2;
    color: #dc2626;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-primary {
    background: #eff6ff;
    color: var(--primary);
    border: 1px solid #dbeafe;
}

.text-primary {
    color: var(--primary);
}

.score-value {
    font-size: 2.75rem;
    font-weight: 850;
    margin-bottom: 2px;
    line-height: 1;
    color: var(--text-main);
    /* Added color for score value */
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-neutral {
    background: #f1f5f9;
    color: #475569;
}

/* --- LAYOUT --- */
#app-root {
    display: grid;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100vh;
}

/* TOP NAV */
.top-nav {
    grid-column: 1 / -1;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-lg);
    justify-content: space-between;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 800;
    font-size: 1.25rem;
}

.brand-logo {
    height: 40px;
    width: auto;
}

.search-container {
    flex: 1;
    max-width: 500px;
    margin: 0 var(--spacing-xl);
}

#search-form {
    display: flex;
    gap: var(--spacing-sm);
}

#dot-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--background);
}

#dot-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
}

#search-form button {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#search-form button:hover {
    background: var(--primary-light);
}

/* Autocomplete Dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.search-suggestion {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.search-suggestion:last-child {
    border-bottom: none;
}

.search-suggestion:hover {
    background-color: var(--background);
}

.suggestion-name {
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
}

.suggestion-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.suggestion-mc {
    margin-left: 8px;
    color: var(--accent);
    font-weight: 600;
}

/* Onboarding & Success Buttons */
.btn-success-full {
    width: 100%;
    padding: 12px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-success-full:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-primary-full {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary-full:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.btn-secondary-full {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary-full:hover {
    background: var(--background);
}

.gap-12 {
    gap: 12px;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-info {
    text-align: right;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 13px;
}

.user-role {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-user-wrapper {
    width: 24px;
    height: 24px;
    margin-right: 0 !important;
    stroke: var(--text-main);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: all 0.3s ease;
}

.icon-user-head {
    transform-origin: center 7px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.user-profile-widget:hover .icon-user-wrapper {
    stroke: var(--accent);
}

.user-profile-widget:hover .icon-user-head {
    transform: scale(1.15) translateY(-1px);
}

/* MAIN CONTENT CONTAINER */
.main-layout {
    grid-column: 1;
    grid-row: 2;
    overflow-y: auto;
    padding: var(--spacing-lg);
    background: var(--background);
}

/* SIDE PANEL (EVIDENCE) */
.evidence-panel {
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 100px);
}

.evidence-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.evidence-header h3 {
    font-size: 14px;
    font-weight: 700;
}

.evidence-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
}

.evidence-empty {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    margin-top: var(--spacing-lg);
}

.evidence-item {
    padding: var(--spacing-sm);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: var(--spacing-sm);
    background: #f8fafc;
    font-size: 12px;
}

.evidence-item.critical {
    border-left: 3px solid var(--danger);
}

.evidence-item.warning {
    border-left: 3px solid var(--warning);
}

.evidence-item h4 {
    font-weight: 700;
    margin-bottom: 4px;
}

.evidence-item p {
    color: var(--text-muted);
    margin-bottom: 4px;
}

.evidence-meta {
    font-size: 10px;
    color: var(--text-light);
    text-align: right;
}

/* --- LAYER 1: EXECUTIVE SUMMARY --- */
.layer-executive {
    display: grid;
    grid-template-columns: 380px 1.2fr 380px;
    gap: var(--spacing-lg);
    background: var(--surface);
    padding: var(--spacing-lg);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: var(--spacing-lg);
    align-items: center;
}

/* User Profile Snippet */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    width: 100%;
}

.user-profile-widget {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    min-width: 0;
    width: 100%;
}

.user-profile-widget:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

.user-info-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role,
.user-trial {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-trial {
    margin-top: -1px;
}

.dropdown-icon {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

/* Collapsed/Hover-Expanded Logic */
/* When definitely collapsed (not pinned, not hovered) */
.collapsed:not(.hover-expanded) .user-info-text,
.collapsed:not(.hover-expanded) .dropdown-icon,
.collapsed:not(.hover-expanded) .user-trial {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none;
    width: 0;
}

.collapsed:not(.hover-expanded) .user-profile-widget {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
}

.collapsed:not(.hover-expanded) .avatar {
    margin: 0 auto;
}

/* User Profile Dropdown */
.profile-dropdown {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0; /* Changed to left align since sidebar is on left now */
    min-width: 240px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 8px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    padding: 10px 16px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: var(--bg-surface-hover);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--text-muted);
}

.dropdown-item:hover i {
    color: var(--text-color);
}

.dropdown-item.text-danger {
    color: var(--error);
}

.dropdown-item.text-danger i {
    color: var(--error);
}

.dropdown-item.text-danger:hover {
    background-color: rgba(244, 67, 54, 0.1);
    /* Subtle red hover */
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 0;
}



.score-card {
    flex: 1;
    /* Take up half the space */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    /* Separator removed from right */
    padding: 0 var(--spacing-lg);
    /* Symmetric padding */
    margin: 0;
    /* Remove margin */
}

.summary-details-compact {
    flex: 1;
    /* Take up the other half */
    padding-left: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-left: 1px solid var(--border-color);
}

.score-ring-container {
    width: 140px;
    height: 140px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: -20px;
}

.score-value {
    font-size: 64px;
    font-weight: 800;
    color: var(--primary);
}

.score-label-container {
    text-align: center;
    margin-top: -12px;
    position: relative;
    z-index: 2;
}

.pillar-header h4 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pillar-header .info-icon {
    font-size: 14px;
    color: var(--text-light, #94a3b8);
    cursor: pointer;
    transition: color 0.15s ease-in-out;
}

.pillar-header .info-icon:hover {
    color: var(--primary);
}

.score-label {
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.trend-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    background: #f1f5f9;
}

/* --- IDENTITY EXECUTIVE (New Left Col) --- */
/* --- IDENTITY EXECUTIVE (New Left Col) --- */
/* --- IDENTITY EXECUTIVE (New Left Col) --- */
.identity-executive {
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center vertically within the grid cell */
    border-right: 1px solid var(--border);
    padding-right: var(--spacing-lg);
    min-width: 0;
    text-align: center;
}

.id-header-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
}

.id-legal-name {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    margin: 0 0 2px 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
    width: 100%;
}

.id-subtitle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}

.id-dot {
    font-family: 'Roboto Mono', monospace;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #475569;
}

/* Stacked details for Authority/Operation */
.id-details-row {
    display: flex;
    flex-direction: column;
    /* Stack vertically */
    gap: 4px;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.id-detail-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    /* Match subtitle weight */
}

.detail-label {
    /* Font matches subtitle now */
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}


.id-metrics-row {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 40px;
    padding-top: 8px;
    /* Reduced gap */
    border-top: none;
    /* Ensure no border */
}

.id-metric-badge-group {
    display: none;
}

.badge-neutral {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.id-metric-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}


/* --- SCORING EXECUTIVE (New Center Col) --- */
.scoring-executive {
    display: flex;
    align-items: center;
    gap: 0;
    border-left: 1px solid var(--border);
    padding-left: var(--spacing-lg);
}

.summary-details-compact {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 140px;
}

.confidence-box label,
.recommendation-box label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-bar .fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.5s ease-out;
}

.rec-badge {
    display: inline-block;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    border-radius: 6px;
    font-size: 14px;
}

.risk-drivers h3 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

.risk-drivers ul {
    list-style: none;
}

.risk-drivers li {
    font-size: 13px;
    padding: 4px 0;
    border-bottom: 1px solid var(--background);
}

.risk-drivers li:before {
    content: "•";
    color: var(--danger);
    margin-right: 8px;
    font-weight: bold;
}

.risk-drivers li.critical-driver {
    color: #991b1b;
    font-weight: 700;
    background: #fef2f2;
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 4px;
    border: 1px solid #fee2e2;
}



/* Violation Highlighting */
tr.critical-violation {
    background-color: #fef2f2 !important;
}

tr.critical-violation td {
    color: #991b1b !important;
    font-weight: 600;
}

tr.critical-violation td:nth-child(2) {
    color: #dc2626 !important;
    font-weight: 800;
}

/* --- LAYER 2: PILLARS --- */
.layer-pillars {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.pillar-card {
    background: var(--surface);
    border-radius: 8px;
    padding: var(--spacing-md);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border-top: 4px solid transparent;
    cursor: pointer;
    transition: transform 0.2s;
}

.pillar-card:hover {
    transform: translateY(-2px);
}

/* Pillar Specific Colors */
.pillar-card:nth-child(1) {
    border-top-color: var(--color-safety);
}

.pillar-card:nth-child(2) {
    border-top-color: var(--color-compliance);
}

.pillar-card:nth-child(3) {
    border-top-color: var(--color-ops);
}

.pillar-card:nth-child(4) {
    border-top-color: var(--color-financial);
}

.pillar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.pillar-header h4 {
    font-size: 13px;
    font-weight: 700;
}

.pillar-score {
    font-size: 18px;
    font-weight: 800;
}

.pillar-metrics {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.metric-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.metric-label {
    color: var(--text-muted);
}

.metric-value {
    font-weight: 600;
}

/* --- LAYER 3: DRILLDOWN --- */
.layer-drilldown {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    min-height: 400px;
}

.tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 var(--spacing-md);
}

.tab-btn {
    padding: var(--spacing-md) var(--spacing-lg);
    background: none;
    border: none;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    padding: var(--spacing-lg);
}

/* DATA TABLES */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: var(--spacing-sm);
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

td {
    padding: var(--spacing-sm);
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}

/* CAB Style Tables for Insurance */
.section-header-cab {
    background: #475569;
    color: white;
    padding: 10px 20px;
    font-weight: 700;
    font-size: 13px;
    border-radius: 8px 8px 0 0;
    margin-top: 32px;
    border: 1px solid #334155;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-cab-container {
    border: 1px solid #e2e8f0;
    background: white;
    margin-bottom: 32px;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    position: relative;
    border-top: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.table-cab {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.table-cab thead th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 11px;
    border-bottom: 2px solid #cbd5e1;
    padding: 10px 16px;
    text-align: left;
}

.table-cab tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
    vertical-align: middle;
}

.table-cab tbody tr:hover {
    background-color: #f1f5f9;
}

.boc3-grid {
    padding: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    background: #fff;
}

.boc3-item-label {
    text-transform: uppercase;
    font-size: 10px;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.boc3-item-value {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.4;
}

.boc3-item-value.company {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
}

.text-success {
    color: #10b981 !important;
}

.text-danger {
    color: #ef4444 !important;
}

.text-warning {
    color: #f59e0b !important;
}

.insurance-summary-card {
    display: flex;
    justify-content: space-between;
    background: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 32px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.insurance-summary-card .summary-item {
    flex: 1;
    border-right: 1px solid #f1f5f9;
    padding: 0 24px;
}

.insurance-summary-card .summary-item:last-child {
    border-right: none;
    padding-right: 0;
}

.insurance-summary-card .summary-item:first-child {
    padding-left: 0;
}

.insurance-summary-card label {
    display: block;
    text-transform: uppercase;
    font-size: 10px;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.insurance-summary-card .value {
    font-size: 16px;
    font-weight: 800;
    color: #1e293b;
}

.insurance-summary-card .value.company {
    color: var(--primary);
}

.insurance-summary-card .value.accent {
    color: var(--accent);
}

/* --- CAB TABLE REFINEMENT (New Style) --- */
.table-cab-new {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.table-cab-new th {
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    padding: 12px 16px;
    border-bottom: 2px solid #e2e8f0;
    text-align: left;
    letter-spacing: 0.5px;
}

.table-cab-new td {
    padding: 14px 16px;
    font-size: 13px;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
}

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

.table-cab-new tr:hover td {
    background: #fdfdfd;
}

/* --- Underwriting Signals & Metric Cards --- */
.metric-card-pro {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card-pro:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.timeline-row-detailed {
    transition: background 0.2s ease;
}

.timeline-row-detailed:hover {
    background: #f8fafc;
}

.badge-muted {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.timeline-row:last-child {
    border-bottom: none !important;
}

/* --- STATES --- */
.empty-view,
.loading-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: var(--spacing-md);
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* --- COMPONENTS --- */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--primary);
}

.btn-outline-primary:hover {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Old Modal Styles Removed */

/* --- Modal Redesign --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #111827;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.report-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}

.report-section h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 8px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.data-label {
    color: #6b7280;
    font-weight: 500;
}

.data-value {
    color: #111827;
    font-weight: 600;
    text-align: right;
}

.badge-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.modal-footer {
    padding: 16px 24px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-map {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #fff;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-map:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

/* --- New Crash Report Modal Styles --- */
.crash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.crash-title h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 12px;
}

.crash-meta {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 4px;
}

.severity-badge {
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.severity-badge.fatal {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.severity-badge.injury {
    background: #ffedd5;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

.severity-badge.tow {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #bae6fd;
}

.crash-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.crash-metric-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.crash-metric-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    display: block;
    margin-bottom: 4px;
}

.crash-metric-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.crash-details-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.detail-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    height: 100%;
}

.detail-section h4 {
    font-size: 0.875rem;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #f1f5f9;
    font-size: 0.9rem;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: #64748b;
    font-weight: 500;
}

.info-value {
    color: #0f172a;
    font-weight: 600;
    text-align: right;
}

.sms-highlight {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.sms-highlight h4 {
    color: #166534;
    border-bottom-color: #bbf7d0;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
}

/* --- FLEET GROUPING --- */
.fleet-group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: var(--spacing-xl);
}

.fleet-group h5 {
    padding: 12px 16px;
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

.fleet-group table {
    border: none;
}

.fleet-group th {
    background: #f8fafc;
}

/* --- INSURANCE AMAZING REDESIGN --- */
.insurance-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.coverage-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.coverage-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.coverage-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.coverage-icon {
    width: 40px;
    height: 40px;
    background: #eff6ff;
    color: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coverage-status-tag {
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 100px;
    text-transform: uppercase;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.coverage-type-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.coverage-limit {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.coverage-details {
    border-top: 1px solid var(--border);
    padding-top: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.coverage-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.coverage-label {
    color: var(--text-muted);
}

.coverage-value {
    color: var(--text-main);
    font-weight: 600;
}

.insurance-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--spacing-sm);
}

.history-timeline {
    position: relative;
    padding-left: 20px;
    border-left: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.timeline-item {
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -27px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--accent);
}

.timeline-content {
    background: var(--surface);
    border-radius: 8px;
    padding: var(--spacing-md);
    border: 1px solid var(--border);
}

.timeline-date {
    font-size: 12px;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 4px;
}

/* --- MODALS --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: none;
    /* Hiddden by default */
    align-items: center;
    justify-content: center;
}

/* Specific override for Login Modal since it should show initially until logged in */
#login-modal.modal-overlay {
    display: flex;
}

.modal-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
}

.login-modal-container {
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.detail-modal-container {
    padding: 24px;
    width: 800px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-title {
    margin-bottom: 24px;
    text-align: center;
}

.detail-title {
    margin-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 8px;
    text-align: left;
}

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

.margin-bottom-24 {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.btn-primary-full {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 700;
    cursor: pointer;
}

.error-text {
    color: var(--danger);
    margin-top: 16px;
    text-align: center;
    display: none;
    font-size: 13px;
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-footer {
    margin-top: 24px;
    text-align: right;
}

.btn-secondary {
    padding: 8px 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}


.modal-overlay {
    display: none;
}

/* ========================================================================= */
/* --- NEW SIDEBAR APP LAYOUT (v50+) --- */
/* ========================================================================= */

.app-body {
    overflow: hidden;
    /* Prevent body scroll, manage in content area */
    background: var(--background);
    margin: 0;
}

.app-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
    transition: all 0.3s ease;
}

/* ========================================= */
/* SIDEBAR                                   */
/* ========================================= */
:root {
    --sidebar-collapsed-width: 72px;
    --sidebar-expanded-width: 280px;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e2e8f0;
    --sidebar-active-bg: #eff6ff;
    --sidebar-active-color: #2563eb;
    --sidebar-text: #64748b;
    --sidebar-text-hover: #1e293b;
    --topbar-height: 64px;
}

.app-sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.02);
    position: relative;
    /* Keep it in-flow by default */
}

/* Collapsed State */
.app-wrapper.collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
}

/* Expanded/Pinned State */
.app-wrapper.pinned .app-sidebar,
.app-wrapper.hover-expanded .app-sidebar {
    width: var(--sidebar-expanded-width);
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--sidebar-border);
    justify-content: space-between;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
}

.sidebar-logo {
    height: 40px;
    width: 40px;
    min-width: 40px;
    /* Prevent shrinking when collapsed */
}

/* Hide text when collapsed */
.app-wrapper.collapsed .brand-text {
    opacity: 0;
    transition: opacity 0.1s;
}

.app-wrapper.pinned .brand-text,
.app-wrapper.hover-expanded .brand-text {
    opacity: 1;
    transition: opacity 0.3s 0.1s;
}

.pin-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 14px;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0;
    /* Hidden when collapsed */
}

.app-wrapper.pinned .pin-btn,
.app-wrapper.hover-expanded .pin-btn {
    opacity: 1;
}

.pin-btn:hover {
    background: var(--background);
    color: var(--text-main);
}

.pin-btn.is-active {
    color: var(--sidebar-active-color);
    transform: rotate(45deg);
    /* Visual indicator for pinned */
}

/* Navigation List */
.sidebar-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 0;
}

.nav-list {
    list-style: none;
    padding: 0 12px;
    margin: 0;
}

.nav-item {
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--background);
    color: var(--sidebar-text-hover);
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-color);
}

.nav-icon {
    font-size: 20px;
    min-width: 24px;
    text-align: center;
    margin-right: 16px;
    /* Space between icon and text */
}

/* Custom Animated SVG Icons */
.nav-icon-svg {
    width: 20px;
    height: 20px;
    min-width: 24px;
    margin-right: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.3s ease;
}

/* Shield Animation */
.nav-link:hover .icon-shield path.shield-check,
.nav-link.active .icon-shield path.shield-check {
    stroke-dasharray: 20;
    stroke-dashoffset: 0;
    animation: drawCheck 0.4s ease-out forwards;
}

.icon-shield path.shield-check {
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
}

@keyframes drawCheck {
    to {
        stroke-dashoffset: 0;
    }
}

.nav-link:hover .icon-shield,
.nav-link.active .icon-shield {
    transform: scale(1.1);
    stroke: var(--success);
}

/* Bullseye Animation */
.nav-link.active .icon-bullseye-arrow {
    opacity: 1;
    transform: translate(0, 0);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.1s;
}

.icon-bullseye-arrow {
    opacity: 0;
    transform: translate(-10px, -10px);
    transition: all 0.3s ease;
}

.nav-link:hover .icon-bullseye,
.nav-link.active .icon-bullseye {
    stroke: var(--danger);
}

.nav-link.active .icon-bullseye-arrow {
    stroke: var(--danger);
    fill: var(--danger);
}

.nav-link:hover .icon-bullseye-arrow {
    opacity: 0.5;
    transform: translate(-5px, -5px);
    stroke: var(--danger);
    fill: var(--danger);
}

/* Book Animation */
.icon-book-open {
    opacity: 0;
    transform: scaleX(0);
    transform-origin: center;
    transition: all 0.3s ease;
}

.icon-book-closed {
    opacity: 1;
    transition: all 0.3s ease;
}

.nav-link:hover .icon-book-closed,
.nav-link.active .icon-book-closed {
    opacity: 0;
    transform: scaleX(0);
}

.nav-link:hover .icon-book-open,
.nav-link.active .icon-book-open {
    opacity: 1;
    transform: scaleX(1);
    stroke: var(--accent);
}


/* Hide labels when collapsed */
.app-wrapper.collapsed .nav-label {
    opacity: 0;
    transition: opacity 0.1s;
}

.app-wrapper.pinned .nav-label,
.app-wrapper.hover-expanded .nav-label {
    opacity: 1;
    transition: opacity 0.3s 0.1s;
}

/* User Profile Footer in Sidebar */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--sidebar-border);
    overflow: visible;
    white-space: nowrap;
    flex-shrink: 0;
    /* Prevent the footer from getting squished vertically */
}

.user-profile-widget {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Hide profile text when collapsed */
.app-wrapper.collapsed .user-info-text {
    display: none;
    opacity: 0;
    transition: opacity 0.1s;
}

.app-wrapper.collapsed #profile-dropdown-icon {
    display: none;
}

.app-wrapper.collapsed .user-profile-widget {
    justify-content: center;
    padding-left: 0;
}

.app-wrapper.pinned .user-info-text,
.app-wrapper.hover-expanded .user-info-text {
    opacity: 1;
    transition: opacity 0.3s 0.1s;
}

.app-wrapper.pinned #profile-dropdown-icon,
.app-wrapper.hover-expanded #profile-dropdown-icon {
    display: block;
}

/* ========================================= */
/* MAIN CONTENT AREA & TOPBAR                */
/* ========================================= */

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Important to prevent flex children from blowing out width */
    height: 100vh;
}

.app-topbar {
    height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-main);
}

.app-content-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    /* Let blocks manage inner padding */
    background: var(--background);
}

/* Reposition existing app root container to fit cleanly inside */
#app-root {
    height: 100%;
    /* We strip out its old grid template since it's now wrapped */
    display: block;
}

/* Hide old top-nav since we moved it into the sidebar/topbar combo */
.top-nav {
    display: none !important;
}

.main-layout {
    grid-column: 1 / -1;
    /* Override old #app-root constraints */
    grid-row: 1;
    height: 100%;
}

.report-container {
    height: 100%;
}

@media (max-width: 1024px) {
    .app-wrapper {
        position: relative;
    }

    .app-sidebar {
        position: absolute;
        left: calc(var(--sidebar-expanded-width) * -1);
        width: var(--sidebar-expanded-width) !important;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
    }

    .app-wrapper.mobile-open .app-sidebar {
        left: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .pin-btn {
        display: none;
        /* Disable pinning on mobile */
    }
}

/* ========================================= */
/* PRINT STYLES FOR EXPORT REPORT            */
/* ========================================= */
@media print {

    /* ---- Page Setup ---- */
    @page {
        size: letter portrait;
        margin: 18mm 14mm;
    }

    /* Force background colors to print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* ---- Hide all chrome: sidebar, topbar, modals, action buttons ---- */
    .app-sidebar,
    .app-topbar,
    .topbar,
    .search-container,
    .tabs-nav,
    .tab-btn,
    .btn-secondary,
    .btn-primary,
    .pin-btn,
    .mobile-menu-btn,
    .modal-overlay,
    #save-dot-btn,
    .tooltip-icon,
    .info-icon,
    #adv-search-query,
    .search-dropdown,
    #loading-state,
    #empty-state {
        display: none !important;
    }

    /* ---- Flatten the overall app shell ---- */
    html, body,
    .app-body,
    .app-wrapper,
    .app-main,
    .app-content-area,
    .main-layout,
    #app-root {
        display: block !important;
        height: auto !important;
        width: 100% !important;
        overflow: visible !important;
        background: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }

    /* ---- Print header: logo + title watermark ---- */
    .report-panels::before {
        content: "CarrierMetric  |  Risk Profile Report";
        display: block;
        font-family: 'Outfit', 'Inter', sans-serif;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 1px;
        text-transform: uppercase;
        color: #94a3b8;
        border-bottom: 1px solid #e2e8f0;
        padding-bottom: 8px;
        margin-bottom: 20px;
    }

    /* ---- Layer 1: Executive Summary — flatten 3-col → stacked ---- */
    .layer-executive {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 10px !important;
        padding: 20px !important;
        margin-bottom: 16px !important;
        page-break-inside: avoid !important;
        box-shadow: none !important;
    }

    /* Remove the internal right-border dividers */
    .identity-executive {
        border-right: none !important;
        padding-right: 0 !important;
        text-align: left !important;
        border-bottom: 1px solid #e2e8f0 !important;
        padding-bottom: 16px !important;
    }

    /* Score section: show inline horizontally */
    .scoring-executive {
        border-left: none !important;
        padding-left: 0 !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 24px !important;
        border-top: 1px solid #e2e8f0 !important;
        padding-top: 16px !important;
    }

    .score-value {
        font-size: 48px !important;
    }

    .score-ring-container {
        width: 100px !important;
        height: 100px !important;
    }

    /* Risk Drivers — show inline with the score */
    .risk-drivers {
        flex: 1 !important;
        padding: 0 !important;
    }

    /* ---- Layer 2: Pillars — flatten 4-col → 2-col grid ---- */
    .layer-pillars {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        margin-bottom: 16px !important;
    }

    .pillar-card {
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-top-width: 4px !important;
        border-radius: 8px !important;
        padding: 14px !important;
        page-break-inside: avoid !important;
        box-shadow: none !important;
        cursor: default !important;
    }

    .pillar-card:hover {
        transform: none !important;
    }

    /* ---- Layer 3: Drilldown tabs — show ALL tabs as sections ---- */
    .layer-drilldown {
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        min-height: 0 !important;
    }

    /* All tab panels visible and labelled */
    .tab-content {
        display: block !important;
        padding: 0 !important;
        margin-bottom: 20px !important;
        page-break-inside: avoid;
    }

    /* Hide raw JSON tab — not useful in a report */
    #tab-raw {
        display: none !important;
    }

    /* ---- Tables ---- */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 11px !important;
        margin-bottom: 16px !important;
    }

    th, td {
        padding: 6px 8px !important;
        border: 1px solid #e2e8f0 !important;
        text-align: left !important;
    }

    th {
        background: #f1f5f9 !important;
        font-weight: 700 !important;
        font-size: 10px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.3px !important;
    }

    tr:nth-child(even) td {
        background: #f8fafc !important;
    }

    /* Keep critical-violation highlighting in print */
    tr.critical-violation td {
        background: #fef2f2 !important;
        color: #991b1b !important;
    }

    /* ---- SaaS Insurance grid — flatten 4-col → 2-col ---- */
    .saas-grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        margin-bottom: 16px !important;
    }

    .saas-grid-2-sidebar {
        grid-template-columns: 1fr 2fr !important;
        gap: 12px !important;
    }

    .saas-card {
        box-shadow: none !important;
        border: 1px solid #e2e8f0 !important;
        page-break-inside: avoid !important;
    }

    /* ---- Page-break hints ---- */
    .layer-executive,
    .layer-pillars,
    .pillar-card,
    .coverage-card,
    .fleet-group,
    .saas-card,
    .saas-alert-banner {
        page-break-inside: avoid !important;
    }

    /* Start drilldown sections on a fresh page */
    .layer-drilldown {
        page-break-before: always !important;
    }

    /* ---- Typography tightening for print ---- */
    body {
        font-size: 12px !important;
        line-height: 1.5 !important;
        color: #0f172a !important;
    }

    h2 { font-size: 16px !important; }
    h3 { font-size: 14px !important; }
    h4 { font-size: 12px !important; }

    /* ---- Remove hover/transition effects ---- */
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* --- SaaS UI Components (Insurance Tab) --- */
.saas-alert-banner {
    background: #fef2f2;
    border-left: 4px solid #dc2626;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 32px;
}
.saas-alert-title {
    color: #b91c1c;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.saas-alert-list {
    margin: 0;
    padding-left: 24px;
    color: #7f1d1d;
    font-size: 13px;
    font-weight: 500;
}

.saas-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}
@media (max-width: 1024px) {
    .saas-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .saas-grid-4 { grid-template-columns: 1fr; }
}

.saas-grid-2-sidebar {
    display: grid;
    grid-template-columns: 1fr 2.5fr;
    gap: 24px;
    margin-bottom: 32px;
}
@media (max-width: 1024px) {
    .saas-grid-2-sidebar { grid-template-columns: 1fr; }
}

.saas-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}
.saas-card-title {
    font-size: 12px;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.saas-card-value {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 6px;
}
.saas-card-subtext {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.saas-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.saas-progress-track {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    margin-top: 12px;
    overflow: hidden;
}
.saas-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Tooltip container */
.saas-tooltip-wrapper {
    position: relative;
    display: inline-block;
    cursor: help;
}
.saas-tooltip-wrapper .saas-tooltip-text {
    visibility: hidden;
    width: max-content;
    max-width: 250px;
    background-color: #1e293b;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px 12px;
    position: absolute;
    z-index: 10;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.saas-tooltip-wrapper .saas-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}
.saas-tooltip-wrapper:hover .saas-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Autocomplete Dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: calc(100% - 90px);
    max-height: 300px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.search-dropdown-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.search-dropdown-item:hover {
    background: var(--background);
}

.search-dropdown-title {
    font-weight: 700;
    color: var(--text-main);
    font-size: 14px;
    margin-bottom: 4px;
}

.search-dropdown-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

/* Info Tooltips */
.label-with-tooltip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.tooltip-icon {
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
}

.tooltip-icon:hover {
    color: var(--primary);
}

.info-modal {
    max-width: 500px;
}

/* ============================================================
   SUPPORT & FEEDBACK MODAL
   ============================================================ */

.support-modal-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    border: 1px solid var(--border);
    animation: support-modal-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes support-modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

.support-modal-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.support-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.support-modal-close:hover {
    background: var(--border);
    color: var(--text-main);
}

/* Form body padding */
#support-form-state,
#support-success-state {
    padding: 24px;
}

.support-section-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Type Selector Grid */
.support-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.support-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 12px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.16s ease;
}

.support-type-btn:hover {
    background: var(--background);
    color: var(--text-main);
    border-color: #cbd5e1;
}

/* Active: Bug Report (red tint) */
.support-type-btn--active-bug {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Active: Feature Request (blue tint) */
.support-type-btn--active-feature {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #2563eb;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Textarea */
.support-textarea {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.875rem;
    font-family: var(--font-main);
    background: var(--background);
    color: var(--text-main);
    resize: vertical;
    min-height: 110px;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.support-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    background: var(--surface);
}

/* Action Row */
.support-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.support-cancel-btn {
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}

.support-cancel-btn:hover {
    color: var(--text-main);
    background: var(--background);
}

.support-submit-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.support-submit-btn:hover:not(:disabled) {
    background: var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.support-submit-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* Success State */
#support-success-state {
    display: flex;
    align-items: center;
    justify-content: center;
}

.support-success-body {
    text-align: center;
    padding: 16px 0 8px;
}

.support-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #dcfce7;
    color: #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    animation: support-bounce 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes support-bounce {
    0%, 100% { transform: translateY(0); }
    30%       { transform: translateY(-10px); }
    60%       { transform: translateY(-4px); }
}

/* Spinner for sending state */
@keyframes support-spin {
    to { transform: rotate(360deg); }
}

.spin-icon {
    animation: support-spin 0.8s linear infinite;
}

/* Enterprise Specific Refinements */
#enterprise-modal .support-modal-header {
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
}

#enterprise-modal .support-modal-title {
    color: white;
}

#enterprise-modal .support-textarea {
    background: #f8fafc;
    border-color: #e2e8f0;
}

#enterprise-modal .support-textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

#enterprise-form-state,
#enterprise-success-state {
    padding: 24px 28px 28px;
}

/* ============================================================
   NOTIFICATION PREFERENCE TOGGLE
   ============================================================ */

/* Toggle slider knob (pure CSS, no JS pseudo-element required) */
.notification-toggle-slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

#notif-enabled-toggle:checked + .notification-toggle-slider::after {
    transform: translateX(20px);
}

/* Smooth colour transition on slider track */
.notification-toggle-slider {
    transition: background-color 0.2s ease;
}
