/* ---------------------------------------------------------------
   Overview Dashboard � Compact Admin-Panel Grid System
   --------------------------------------------------------------- */

/* -- Master grid -- */
.ov-grid {
    display: grid;
    /* minmax(0, 1fr) prevents grid blowout from wide descendants (tables, long
       values) — bare 1fr == minmax(auto,1fr) grows to min-content and overflows. */
    grid-template-columns: minmax(0, 1fr);
    gap: 0.6rem;
    width: 100%;
    padding-top: 6px;
}

.ov-grid#companyInfoGrid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

/* -- Base card -- */
.ov-card {
    background: rgba(248, 250, 255, 0.32) !important;
    border: 1.5px solid rgba(37, 99, 235, 0.14) !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    padding: 0.7rem 0.85rem !important;
    min-height: 0;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.ov-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07) !important;
    border-color: rgba(37, 99, 235, 0.26) !important;
}

/* Force basics-table-container to match .ov-card when used as one */
.ov-card.basics-table-container {
    background: rgba(248, 250, 255, 0.32) !important;
    border: 1.5px solid rgba(37, 99, 235, 0.14) !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
}

.ov-card.basics-table-container:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07) !important;
    border-color: rgba(37, 99, 235, 0.26) !important;
}

/* -- Shared typography -- */
.ov-card-label {
    font-size: 0.825rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #475569;
    margin-bottom: 0.15rem;
    line-height: 1.2;
}

.ov-card-val {
    font-size: 1.045rem;
    font-weight: 600;
    color: #1c273c;
    line-height: 1.35;
}

/* ------------------------------------------
   Side-stack items (ISS, Risk, Crashes, etc.)
   ------------------------------------------ */
.ov-side-stack {
    display: flex;
    flex-direction: column;
    gap: 0;
    justify-content: stretch;
}

.ov-side-stack .ov-side-item {
    flex: 1;
}

.ov-side-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.7rem !important;
    min-height: 0;
    border-radius: 0 !important;
    border-left: 1.5px solid rgba(37, 99, 235, 0.14) !important;
    border-right: 1.5px solid rgba(37, 99, 235, 0.14) !important;
    border-top: none !important;
    border-bottom: 1px solid rgba(37, 99, 235, 0.08) !important;
    box-shadow: none !important;
}

.ov-side-stack .ov-side-item:first-child {
    border-top: 1.5px solid rgba(37, 99, 235, 0.14) !important;
    border-radius: 10px 10px 0 0 !important;
}

.ov-side-stack .ov-side-item:last-child {
    border-bottom: 1.5px solid rgba(37, 99, 235, 0.14) !important;
    border-radius: 0 0 10px 10px !important;
}

.ov-side-label {
    font-size: 0.745rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    line-height: 1.15;
    flex: 1;
    min-width: 0;
}

.ov-side-value {
    font-size: 1.275rem;
    font-weight: 800;
    color: #1c273c;
    line-height: 1.1;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.ov-side-value-accent {
    color: #2563eb;
}

.ov-side-value-sm {
    font-size: 1.005rem;
}

.ov-side-sub {
    font-size: 0.845rem;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
}

.ov-side-sub-label {
    font-size: 0.705rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-right: 0.15rem;
}

/* ISS / Risk � use base card style, accent only on value color */
.ov-kpi-iss,
.ov-kpi-risk {
    /* inherits .ov-card background and border */
}

/* Alerts inside side-stack */
.ov-side-item-alerts .snapshot-alerts-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: flex-end;
    min-height: 0;
}

/* Alerts summary styles */
.alerts-summary {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}
.alerts-count {
    color: var(--danger);
    font-weight: 800;
    font-size: 1.225rem;
    line-height: 1;
}
.alerts-names {
    color: var(--text-muted);
    font-size: 0.945rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

/* ------------------------------------------
   Row-triple layout � chart + table + side stack
   ------------------------------------------ */
.ov-row-triple {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
    align-items: stretch;
}

/* Four-card row: Inspections/Crashes + the three SAFER option lists side by side.
   Stacks to one column below desktop. */
.ov-row-quad {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
    align-items: stretch;
}

/* ------------------------------------------
   Row-even layout � equal 50/50 split
   ------------------------------------------ */
.ov-row-even {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
    align-items: stretch;
}

/* Prevent risk-section inside row-even from spanning full width */
.ov-row-even > .ov-risk-section {
    grid-column: auto;
}

/* ------------------------------------------
   Risk Analysis Section
   ------------------------------------------ */
.ov-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ov-section-label {
    font-size: 0.845rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #64748b;
    padding-left: 0.15rem;
}

.ov-risk-section {
    background: rgba(248, 250, 255, 0.45);
    border: 1.5px solid rgba(37, 99, 235, 0.12);
    border-radius: 12px;
    padding: 0.6rem;
}

.ov-risk-top {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 0.5rem;
}

/* When risk section is inside a 50/50 split, stack the top row */
.ov-row-even .ov-risk-top {
    grid-template-columns: 1fr;
}

/* When risk section is inside a 50/50 split, stack trends to 2 cols */
.ov-row-even .ov-trends-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ov-risk-cell {
    min-height: 0;
}

.ov-risk-alerts .snapshot-alerts-inline {
    min-height: 28px;
    justify-content: flex-start;
    flex: none;
}

.ov-risk-reasons .snapshot-risk-reasons {
    font-size: 0.975rem !important;
    line-height: 1.4;
    white-space: normal;
}

.ov-risk-trends-card {
    padding: 0.55rem 0.8rem !important;
}

.ov-trends-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.ov-trend-item {
    display: flex;
    flex-direction: column;
    padding: 0.35rem 0.5rem;
    border-radius: 7px;
    background: rgba(37, 99, 235, 0.04);
    border: 1.5px solid rgba(37, 99, 235, 0.10);
}

.ov-trend-label {
    font-size: 0.745rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
    line-height: 1.2;
}

.ov-trend-val {
    font-size: 1.005rem;
    font-weight: 700;
    color: #1c273c;
    line-height: 1.25;
}

/* ------------------------------------------
   ROW 3�4 � Detail Cards (Company, Fleet, etc.)
   ------------------------------------------ */
.ov-detail {
    padding: 0.7rem 0.85rem !important;
}

.ov-detail-title {
    font-size: 0.905rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1e3a5f;
    margin-bottom: 0.4rem;
    padding-bottom: 0.3rem;
    border-bottom: 1.5px solid rgba(37, 99, 235, 0.14);
}

.ov-company-name {
    font-size: 1.325rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    color: #1c273c;
}

/* Field grids */
.ov-field-grid {
    display: grid;
    gap: 0.35rem 0.7rem;
}

.ov-field-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ov-field-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ov-field-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Compact field text */
.ov-detail p {
    font-size: 0.975rem;
    line-height: 1.4;
    margin: 0;
}

.ov-detail p strong {
    font-size: 0.945rem;
    font-weight: 700;
    color: #475569;
    margin-right: 0.15rem;
}

.ov-detail p span {
    font-size: 0.975rem;
    color: #1c273c;
}

.ov-detail .warning-item {
    font-size: 0.945rem;
    line-height: 1.3;
}

/* Row 0: Identity + Contact + Addresses (equal 3-col at desktop) */
.ov-detail-identity { grid-column: 1 / -1; }
.ov-detail-contact { grid-column: 1 / -1; }
.ov-detail-addresses { grid-column: 1 / -1; }

/* Compliance */
.ov-detail-compliance { grid-column: 1 / -1; }

/* Fleet */
.ov-detail-fleet { grid-column: 1 / -1; }

/* Full-width cards */
.ov-full { grid-column: 1 / -1; }

/* Half-width cards */
.ov-half { grid-column: 1 / -1; }

/* Compact BASIC chart card */
.ov-chart-compact {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ov-chart-compact .basics-chart-canvas-wrap {
    min-height: 140px !important;
    flex: 1;
}

/* Chart controls bar � single horizontal line above the chart */
.ov-chart-controls-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    margin-bottom: 0.35rem;
    overflow-x: auto;
}

.ov-chart-controls-inline {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    gap: 0.25rem;
}

.ov-chart-controls-inline .chart-toggle-btn {
    width: auto;
    padding: 0.2rem 0.45rem;
    font-size: 0.805rem;
    border-radius: 5px;
    white-space: nowrap;
}

.ov-chart-range-inline {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
    flex-shrink: 0;
}

.ov-chart-range-inline .chart-controls-label {
    font-size: 0.775rem;
    margin: 0;
}

.ov-chart-range-inline .chart-range-select {
    min-height: 24px;
    padding: 0.15rem 0.4rem;
    font-size: 0.845rem;
    border-radius: 5px;
}

/* Compact carrier timeline card */
.ov-timeline-compact {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ov-timeline-compact .carrier-timeline-shell,
.ov-timeline-compact .carrier-timeline-track {
    flex: 1;
    min-height: 140px;
}

.ov-timeline-compact .carrier-timeline-toolbar {
    margin-bottom: 0.4rem;
}

/* Switch to 12-col grid at desktop widths */
@media (min-width: 992px) {
    .ov-grid {
        grid-template-columns: repeat(12, minmax(0, 1fr));
        gap: 0.6rem;
    }

    .ov-grid#companyInfoGrid {
        grid-template-columns: repeat(12, minmax(0, 1fr));
    }

    .ov-kpi-strip {
        grid-column: 1 / -1;
    }

    .ov-risk-section {
        grid-column: 1 / -1;
    }

    /* Three-column layout: make columns equal width for Overview row */
    .ov-row-triple {
        grid-column: 1 / -1;
        /* Narrow first (ISS/Risk score) column so its labels and values sit closer
           together; the BASIC table and chart take the remaining width. */
        grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr) minmax(0, 1.6fr);
        align-items: stretch;
    }

    /* Inspections/Crashes table gets a little more room; the three SAFER lists
       share the rest equally. */
    .ov-row-quad {
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
        align-items: stretch;
    }

    /* Timeline + Risk Analysis � equal 50/50 */
    .ov-row-even {
        grid-column: 1 / -1;
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
    }

    .ov-row-even > .ov-risk-section {
        grid-column: auto;
    }

    /* Row 0: Identity + Contact + Addresses � equal thirds */
    .ov-detail-identity { grid-column: span 4; }
    .ov-detail-contact { grid-column: span 4; }
    .ov-detail-addresses { grid-column: span 4; }

    .ov-detail-compliance { grid-column: span 4; }
    .ov-detail-fleet { grid-column: span 8; }

    /* Full-width */
    .ov-full { grid-column: 1 / -1; }

    /* Half-width */
    .ov-half { grid-column: span 6; }
}

/* Medium screens */
@media (min-width: 992px) and (max-width: 1279px) {
    .ov-kpi-strip {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .ov-risk-top {
        grid-template-columns: 1fr 1fr;
    }

    .ov-risk-reasons {
        grid-column: 1 / -1;
    }

    .ov-detail-identity { grid-column: span 4; }
    .ov-detail-contact { grid-column: span 4; }
    .ov-detail-addresses { grid-column: span 4; }

    .ov-detail-compliance { grid-column: span 5; }
    .ov-detail-fleet { grid-column: span 7; }

    .ov-field-grid-4 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ov-row-triple {
        grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr) minmax(0, 1.6fr);
    }

    .ov-row-even {
        grid-template-columns: 1fr 1fr;
    }
}

/* Small screens */
@media (max-width: 991px) {
    .ov-kpi-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ov-risk-top {
        grid-template-columns: 1fr;
    }

    .ov-trends-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ov-field-grid-3,
    .ov-field-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ov-field-grid-2 {
        grid-template-columns: 1fr;
    }

    .ov-row-triple {
        grid-template-columns: 1fr;
    }

    .ov-row-even {
        grid-template-columns: 1fr;
    }

    /* On mobile, side stack goes horizontal in two rows */
    .ov-side-stack {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.35rem;
    }
}

@media (max-width: 600px) {
    .ov-kpi-strip {
        grid-template-columns: 1fr 1fr;
    }

    .ov-kpi {
        min-height: 66px;
    }

    .ov-kpi-value {
        font-size: 1.325rem;
    }

    .ov-trends-grid {
        grid-template-columns: 1fr 1fr;
    }

    .ov-field-grid-2,
    .ov-field-grid-3,
    .ov-field-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Remove old analytics-row wrapper behavior */
.overview-analytics-row {
    display: contents;
}

/* --- end Overview Dashboard --- */

/* ---------------------------------------------------------------
   Global card restyling � apply .ov-card look to all tab cards
   (except profile saved-report cards)
   --------------------------------------------------------------- */
#pageContent .card:not(.profile-history-card),
#pageContent .subpanel-card,
#pageContent .map-shell,
#pageContent .violation-card,
#pageContent .dashboard-section-header {
    background: rgba(248, 250, 255, 0.32) !important;
    border: 1.5px solid rgba(37, 99, 235, 0.14) !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
}

#pageContent .card:not(.profile-history-card):hover,
#pageContent .subpanel-card:hover,
#pageContent .map-shell:hover,
#pageContent .violation-card:hover,
#pageContent .dashboard-section-header:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07) !important;
    border-color: rgba(37, 99, 235, 0.26) !important;
}

/* ---------------------------------------------------------------
   Analytics Tools
   --------------------------------------------------------------- */
.analytics-tool-card {
    padding: 1rem 1.25rem !important;
    margin-bottom: 0.5rem;
}

.analytics-tool-header {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1.5px solid rgba(37, 99, 235, 0.12);
}

.analytics-tool-title {
    font-size: 0.945rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1e3a5f;
    margin-bottom: 0.2rem;
}

.analytics-tool-desc {
    font-size: 0.905rem;
    color: #64748b;
    line-height: 1.4;
    margin: 0;
}

.analytics-tool-body {
    min-height: 0;
}

.analytics-chart-wrap {
    position: relative;
    min-height: 200px;
}

.analytics-chart-wrap canvas {
    width: 100% !important;
    max-height: 320px;
}

.analytics-empty {
    display: block;
    padding: 1.5rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.975rem;
    font-style: italic;
}

/* Summary strips */
.analytics-summary-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(37, 99, 235, 0.08);
}

.analytics-alert-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.905rem;
    line-height: 1.3;
}

.analytics-alert-ok {
    background: rgba(34, 197, 94, 0.08);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.analytics-alert-warn {
    background: rgba(245, 158, 11, 0.08);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.analytics-alert-active {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Heatmap */
.analytics-heatmap-scroll {
    overflow-x: auto;
}

.analytics-heatmap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.analytics-heatmap-table th,
.analytics-heatmap-table td {
    padding: 0.35rem 0.5rem;
    text-align: center;
    border: 1px solid rgba(37, 99, 235, 0.08);
    white-space: nowrap;
}

.analytics-heatmap-corner {
    text-align: left !important;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.analytics-heatmap-col-header {
    font-weight: 700;
    color: #475569;
    font-size: 0.805rem;
    letter-spacing: 0.04em;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.analytics-heatmap-row-header {
    text-align: left !important;
    font-weight: 700;
    color: #1e3a5f;
    font-size: 0.875rem;
}

.analytics-heatmap-cell {
    font-weight: 600;
    font-size: 0.845rem;
    min-width: 55px;
    transition: transform 0.1s ease;
}

.analytics-heatmap-cell:hover {
    transform: scale(1.08);
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.analytics-heatmap-empty {
    color: #cbd5e1;
    background: #f8fafc !important;
}

/* Funnel */
.analytics-funnel-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.analytics-funnel-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.analytics-funnel-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.04);
    border: 1px solid rgba(37, 99, 235, 0.08);
}

.analytics-funnel-stat-val {
    font-size: 1.425rem;
    font-weight: 800;
    line-height: 1.1;
}

.analytics-funnel-stat-label {
    font-size: 0.775rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-top: 0.15rem;
}

.analytics-funnel-breakdown {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.905rem;
    color: #475569;
}

/* Insurance gap */
.analytics-gap-bars {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.analytics-gap-row {
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    border: 1.5px solid rgba(37, 99, 235, 0.1);
    background: rgba(248, 250, 255, 0.5);
}

.analytics-gap-type {
    font-weight: 700;
    font-size: 0.905rem;
    color: #1e3a5f;
    margin-bottom: 0.3rem;
}

.analytics-gap-bar-track {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.3rem;
}

.analytics-gap-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.analytics-gap-active .analytics-gap-bar-fill { background: #22c55e; width: 100%; }
.analytics-gap-caution .analytics-gap-bar-fill { background: #f59e0b; width: 75%; }
.analytics-gap-warning .analytics-gap-bar-fill { background: #fb923c; width: 50%; }
.analytics-gap-critical .analytics-gap-bar-fill { background: #ef4444; width: 25%; }
.analytics-gap-expired .analytics-gap-bar-fill { background: #94a3b8; width: 100%; }

.analytics-gap-dates {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.845rem;
    color: #64748b;
}

.analytics-gap-status-badge {
    font-weight: 700;
    font-size: 0.805rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.analytics-gap-active .analytics-gap-status-badge { background: rgba(34,197,94,0.12); color: #16a34a; }
.analytics-gap-caution .analytics-gap-status-badge { background: rgba(245,158,11,0.12); color: #d97706; }
.analytics-gap-warning .analytics-gap-status-badge { background: rgba(251,146,60,0.12); color: #ea580c; }
.analytics-gap-critical .analytics-gap-status-badge { background: rgba(239,68,68,0.12); color: #dc2626; }
.analytics-gap-expired .analytics-gap-status-badge { background: rgba(148,163,184,0.12); color: #64748b; }

.analytics-gap-amount {
    font-size: 0.845rem;
    color: #475569;
    font-weight: 600;
    margin-top: 0.15rem;
}

/* Top Violations by Category */
.analytics-top-violations-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.analytics-top-viol-category {
    border: 1.5px solid rgba(37, 99, 235, 0.10);
    border-radius: 8px;
    padding: 0.6rem 0.7rem;
    background: rgba(248, 250, 255, 0.35);
}

.analytics-top-viol-category-name {
    font-size: 0.845rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #1e3a5f;
    margin-bottom: 0.35rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(37, 99, 235, 0.08);
}

.analytics-top-viol-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.analytics-top-viol-table th {
    font-size: 0.775rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    padding: 0.2rem 0.35rem;
    text-align: center;
    border-bottom: 1px solid rgba(37, 99, 235, 0.08);
}

.analytics-top-viol-table th:first-child {
    text-align: left;
}

.analytics-top-viol-table td {
    padding: 0.3rem 0.35rem;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.analytics-top-viol-num {
    text-align: center;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.analytics-viol-code-btn {
    background: none;
    border: none;
    color: #2563eb;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-decoration-color: rgba(37, 99, 235, 0.3);
    text-underline-offset: 2px;
    transition: color 0.12s ease;
}

.analytics-viol-code-btn:hover {
    color: #1d4ed8;
    text-decoration-color: #1d4ed8;
}

/* Violation description popup */
.analytics-viol-popup {
    position: absolute;
    z-index: 9999;
    width: 320px;
    max-width: calc(100vw - 16px);
    background: #fff;
    border: 1.5px solid rgba(37, 99, 235, 0.18);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.14);
    animation: analytics-popup-in 0.15s ease;
}

@keyframes analytics-popup-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.analytics-viol-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid rgba(37, 99, 235, 0.1);
    font-size: 0.945rem;
    color: #1e3a5f;
}

.analytics-viol-popup-close {
    background: none;
    border: none;
    font-size: 1.125rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
}

.analytics-viol-popup-close:hover {
    color: #ef4444;
}

.analytics-viol-popup-body {
    padding: 0.6rem 0.75rem;
    font-size: 0.905rem;
    color: #475569;
    line-height: 1.5;
}

/* BASIC Category History Charts */
.analytics-basic-history-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.analytics-basic-history-item {
    border: 1.5px solid rgba(37, 99, 235, 0.10);
    border-radius: 8px;
    padding: 0.6rem 0.7rem;
    background: rgba(248, 250, 255, 0.35);
}

.analytics-basic-history-title {
    font-size: 0.845rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #1e3a5f;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.analytics-basic-history-score {
    font-weight: 700;
    font-size: 0.825rem;
    color: #1e3a5f;
    text-transform: none;
    letter-spacing: 0;
}

.analytics-basic-history-threshold-label {
    font-weight: 600;
    font-size: 0.775rem;
    color: #ef4444;
    margin-left: auto;
    text-transform: none;
    letter-spacing: 0;
}

.analytics-basic-history-canvas-wrap {
    position: relative;
    height: 160px;
}

.analytics-basic-history-canvas-wrap canvas {
    width: 100% !important;
}

@media (max-width: 768px) {
    .analytics-top-violations-grid,
    .analytics-basic-history-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) {
    .analytics-funnel-layout {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .analytics-funnel-stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1279px) {
    .company-snapshot-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .responsive-panel-row {
        grid-template-columns: 1fr;
    }

    .company-card-span-3 {
        grid-column: 1 / -1;
    }

    .basics-chart-layout {
        grid-template-columns: 220px minmax(0, 1fr);
    }
}

@media (max-width: 991px) {
    .app-header .container {
        flex-wrap: wrap;
        padding: 0.5rem 1rem 0.25rem;
    }

    .app-header-top-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 1rem;
    }

    .app-header-menu {
        position: static;
        transform: none;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.35rem;
    }

    .app-header-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .app-header-search {
        min-width: 100%;
        width: 100%;
    }

    .nav-user {
        width: 100%;
        justify-content: space-between;
        border-radius: 16px;
    }

    .tool-intro-hero,
    .auth-page-grid {
        display: grid;
        grid-template-columns: 1fr;
    }

    .tool-intro-stats,
    .tool-intro-points,
    .company-snapshot-grid,
    .overview-analytics-row,
    .violations-grid,
    .basics-two-column,
    .two-column-grid {
        grid-template-columns: 1fr !important;
    }

    .company-card-span-2,
    .company-card-span-3 {
        grid-column: auto;
    }

    .basics-chart-layout {
        grid-template-columns: 1fr;
    }

    .basics-chart-container,
    .basics-table-snapshot,
    .dashboard-main .company-snapshot-grid > .card,
    .dashboard-main .company-snapshot-grid > .info-panel {
        min-height: auto;
    }

    .snapshot-risk-trends {
        grid-template-columns: 1fr;
    }

    .carrier-timeline-track {
        min-width: 720px;
    }

    .auth-brand-panel,
    .auth-form-panel {
        padding: 2rem;
    }
}

