/*
 * Dashboard widget + chrome styles (mt-*). Globalized 2026-05-17 to fix
 * a regression: PR #600 extracted widget markup into child components,
 * but these rules were component-scoped to MorningTriageDefault.razor.css
 * (no ::deep) so they no longer reached the extracted widgets or
 * /dashboard-preview. The mt- prefix is collision-safe globally. The
 * scoped copy stays until PR 3 retires MorningTriageDefault.
 */

.mt-page {
    padding: var(--space-4) var(--space-5);
    background: var(--bg-page);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* ── PAGE HEAD ── */

.mt-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border);
}

.mt-h1 {
    font-family: var(--font-display);
    font-size: var(--fs-2xl);
    font-weight: 700;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    color: var(--text-heading);
    margin: 0;
}

.mt-head-sub {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

.mt-scope {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-card);
}

.mt-scope-btn {
    padding: 6px 14px;
    font-family: var(--font-main);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: transparent;
    border: 0;
    border-right: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.mt-scope-btn:last-child {
    border-right: none;
}

.mt-scope-btn:hover {
    background: var(--bg-row-alt);
}

.mt-scope-btn.is-active {
    background: var(--cam-navy);
    color: var(--cam-yellow);
}

.mt-personnel-picker {
    min-width: 220px;
    max-width: 320px;
}

/* ── COMPLIANCE WRAP ── */

.mt-comp-wrap {
    margin: 0;
}

/* ── KPI ROW (canonical 4 tiles: Active Pipeline, Pipeline Pressure,
   My Open Actions, Data Quality Gaps) — 4 across, spans full row width.
   (Was repeat(5,1fr) from a retired 5-tile layout, leaving a dead 5th
   column so 4 tiles only filled 4/5 of the page; per Lee 2026-05-15.) ── */

.mt-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
}

/* ── PRESSURE DRILL-DOWN ROW (3 columns: Execution · Momentum · Coverage) ──
   Targeted Client Coverage relocated 2026-04-27 to the work row; this row is
   strictly opportunity-pressure now. */

.mt-pressure-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap);
    min-height: 260px;
}

/* ── WORK ROW (Upcoming Deadlines · Targeted Client Coverage) ──
   2 columns as of 2026-05-16 (item 10, Layout A). Signal Inbox moved out of
   this row to a full-width Director-only strip near the bottom, so the row is
   evenly balanced for every role with no blank slot. */

.mt-work-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gap);
    min-height: 260px;
}

.mt-pressure-grid {
    display: grid;
    grid-template-rows: repeat(3, 1fr);
    gap: 6px;
    padding: var(--space-2);
}

.mt-pressure {
    padding: var(--space-2) var(--space-3);
    border-radius: 4px;
    background: var(--bg-row-alt);
    border-left: 3px solid var(--border);
}

.mt-pressure-label {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
}

.mt-pressure-value {
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.1;
}

.mt-pressure-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.mt-pressure--hi {
    background: rgba(220,38,38,0.06);
    border-left-color: var(--negative);
}

.mt-pressure--lo {
    background: rgba(0,128,96,0.06);
    border-left-color: var(--positive);
}

/* ── MOMENTUM STRIP ── */

.mt-momentum {
    background: var(--cam-navy);
    color: var(--cam-yellow);
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
    border-radius: 4px;
}

.mt-mom-label {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cam-yellow);
}

.mt-mom-dot {
    color: var(--positive);
    margin-right: 4px;
}

.mt-mom-stat {
    opacity: 0.85;
}

.mt-mom-close {
    margin-left: auto;
    background: transparent;
    border: 0;
    color: var(--cam-yellow);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
}

.mt-mom-close:hover {
    opacity: 1;
}

/* ── BID FOLLOW-UP ROW (BID FOLLOW-UP + Fresh Leads, 50/50) ──
   Added 2026-04-28. Mirrors the work-row card density but at half-width per
   card so the two relationship-driven feeds sit side-by-side. */

.mt-bid-follow-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gap);
    min-height: 240px;
}

/* ── DATA QUALITY ROW (3 cols: Required Fields · Loss Feedback · Go/No-Go) ──
   Added 2026-05-03. Three "missing-something" widgets sit at 1/3 width so a
   user can sweep all data-hygiene gaps in one row. Mirrors mt-pressure-row
   layout. */
.mt-data-quality-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap);
    min-height: 260px;
}

/* ── CONTACT QUALITY ROW (1 col: Opp Missing Contact; 2nd col reserved for
   "Owned Client Missing Contact" when activated) ── */
.mt-contact-quality-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap);
    min-height: 240px;
}

/* ── FUNNEL ROW (full-width vertical bars by stage — 2026-04-28) ──
   Single full-width column wrapping the per-stage vertical bar chart.
   Rebuilt from the old horizontal 5-bucket aggregate to one column per
   active StageRule (5, 10, 15, 20, 30, 35, 40, 50, 60, 70). */

.mt-funnel-row-wrap {
    display: block;
}

/* Full-width single-column wrapper for At-Risk Proposals + Recent Activity
   Feed, added 2026-05-03. Same shape as mt-funnel-row-wrap. */
.mt-fullwidth-row {
    display: block;
}

/* ── REPORTS ROW removed 2026-04-27 — Pinned Reports placement TBD.
   See docs/idea-lab/1-capture/pinned-reports-placement_04.27.26.md. */

/* ── DUE CHIP ── */

.mt-due-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg-row-alt);
    color: var(--text-secondary);
}

.mt-due-chip--overdue {
    background: rgba(220,38,38,0.12);
    color: var(--negative);
}

.mt-due-chip--urgent {
    background: rgba(216,95,39,0.12);
    color: var(--stage-active);
}

.mt-due-chip--soon {
    background: rgba(184,138,0,0.14);
    color: var(--warning);
}

/* ── NEVER BADGE ──
   Sits beside .mt-due-chip on Coverage / Bid Follow-Up rows for opps that
   have zero logged client contacts. The chip itself shows days-since-creation
   in this case (so a 600d-old never-touched opp reads differently from a
   30d-old one); this badge tags the row as "never any contact" at a glance. */
.mt-never-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 0.25rem;
    padding: 0.05rem 0.3rem;
    border-radius: 999px;
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.2;
    background: rgba(220,38,38,0.10);
    color: var(--negative);
    border: 1px solid rgba(220,38,38,0.32);
}

/* ── DATE BLOCK (Next Actions slot) ── */

.mt-date-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 2px solid var(--cam-yellow);
    padding-right: var(--space-2);
    font-family: var(--font-mono);
}

.mt-date-day {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1;
}

.mt-date-month {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

/* ── LEAD BADGES (Fresh Leads slot) ── */

.mt-lead-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.mt-lead-badge--bid {
    background: var(--cam-yellow);
    color: var(--text-heading);
}

.mt-lead-badge--fed {
    background: var(--cam-navy);
    color: var(--text-logo);
}

.mt-lead-badge--dec {
    background: var(--positive);
    color: var(--text-logo);
}

.mt-lead-badge--dri {
    background: var(--stage-active);
    color: var(--text-logo);
}

/* ── FUNNEL (per-stage vertical bars) ──
   Rebuilt 2026-04-28. One column per active StageRule (5/10/15/20/30/35/
   40/50/60/70), bar height encodes count relative to the busiest stage.
   Count number above the bar, stage label below. Uses CSS variables only —
   no hardcoded colors. */

.mt-funnel-vertical {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: var(--space-2);
    padding: var(--space-3) var(--space-2);
    align-items: end;
    min-height: 220px;
}

.mt-funnel-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0; /* allow narrow columns at smaller widths */
}

.mt-funnel-col-count {
    font-family: var(--font-display);
    font-size: var(--fs-md);
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.1;
}

.mt-funnel-col-track {
    width: 100%;
    height: 140px;
    background: var(--bg-row-alt);
    border-radius: 3px;
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.mt-funnel-col-bar {
    width: 100%;
    background: var(--stage-active);
    border-radius: 3px 3px 0 0;
    transition: height 200ms ease;
    min-height: 4px;
}

.mt-funnel-col-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

@media (max-width: 1100px) {
    .mt-funnel-vertical {
        grid-template-columns: repeat(5, 1fr);
        row-gap: var(--space-3);
    }
}

@media (max-width: 640px) {
    .mt-funnel-vertical {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── TOAST ── */

.mt-toast {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--cam-navy);
    color: var(--cam-yellow);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    z-index: var(--z-toast);
    animation: mt-toast-in 200ms ease-out;
}

@keyframes mt-toast-in {
    from { transform: translateY(8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ── LOADING ── */

.mt-loading {
    padding: var(--space-6);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--text-muted);
    text-align: center;
}

/* ── RESPONSIVE ── */

/* Mid-width: bring 3-col rows down before going single-col so cards don't get
   cramped. Pressure row → 2-col, Work row → 2-col (stacks Targeted Client
   Coverage under the Attention/Next-Action pair). KPI row also wraps. */
@media (max-width: 1400px) {
    .mt-pressure-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .mt-work-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .mt-data-quality-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .mt-kpi-row {
        /* 4 tiles → clean 2x2 below 1400px (3-col would leave an uneven 3+1). */
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1100px) {
    .mt-pressure-row {
        grid-template-columns: 1fr;
    }

    .mt-kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .mt-work-row,
    .mt-bid-follow-row,
    .mt-data-quality-row,
    .mt-contact-quality-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .mt-page {
        padding: var(--space-3);
        gap: var(--space-3);
    }

    .mt-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .mt-kpi-row {
        grid-template-columns: 1fr;
    }
}
