/* Laurent home — commercial pipeline dashboard.
 *
 * Plain-language: dense, three-region layout the marketing director
 * opens first thing each morning. Header strip on top, sticky filter
 * bar under it, two-pane body (rail + focus) for the bulk of the
 * screen, leverage table at the foot. Monospaced numbers in the
 * leverage table because Laurent reads columns of figures and lines
 * have to align to the eye.
 */

.cdd-root {
    color: var(--text-primary);
    background: var(--bg-primary);
    padding: 16px 20px 24px;
    /* WHY: 1280px+ target width per scope §4.3. Breaks gracefully
       below: filter bar wraps, footer table scrolls horizontally. */
}

.cdd-empty {
    color: var(--text-muted);
    font-style: italic;
    padding: 16px;
}
.cdd-empty-soft {
    color: var(--text-secondary);
    font-style: normal;
}

/* ---- Header strip ---- */
.cdd-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 4px 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.cdd-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-bright);
    margin: 0 0 6px;
    letter-spacing: -0.2px;
}
.cdd-header-numbers {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.cdd-header-num strong {
    color: var(--text-bright);
    font-weight: 600;
}
.cdd-sep { color: var(--text-muted); }
.cdd-branch-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.cdd-branch-chip {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font);
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
}
.cdd-branch-chip:hover {
    background: var(--card-hover);
    color: var(--text-bright);
}
.cdd-branch-chip.is-active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--text-bright);
}

/* ---- Filter bar (sticky) ---- */
.cdd-filterbar {
    position: sticky;
    top: 48px; /* topbar height */
    z-index: 50;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.cdd-filter {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
    /* WHY: native select for accessibility + zero-JS keyboard nav. */
}
.cdd-filter:focus {
    outline: none;
    border-color: var(--accent);
}
.cdd-new-deal {
    background: var(--accent);
    color: white;
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-left: auto;
    transition: background 0.1s;
}
.cdd-new-deal:hover { background: var(--accent-hover); }

/* ---- Body (rail + focus) ---- */
.cdd-body {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    margin-bottom: 24px;
    /* WHY: 320px rail width keeps deal titles single-line on average
       (mid-length French RFP names). The focus pane gets the rest. */
}

@media (max-width: 1100px) {
    .cdd-body {
        grid-template-columns: 1fr;
        /* On narrower screens stack: rail above focus, single column
           reading order. */
    }
}

.cdd-rail {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    min-height: 320px;
}
.cdd-rail-section + .cdd-rail-section { margin-top: 8px; }
.cdd-rail-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 8px 4px;
    font-weight: 600;
}
.cdd-rail-nudges .cdd-empty-soft {
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-light);
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.cdd-deal-row {
    width: 100%;
    text-align: left;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 8px 10px;
    cursor: pointer;
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
        "dot title money"
        "dot meta meta";
    gap: 4px 8px;
    align-items: center;
    transition: background 0.1s, border-color 0.1s;
    font-family: var(--font);
    font-size: 12px;
}
.cdd-deal-row:hover { background: var(--bg-tertiary); }
.cdd-deal-row.is-selected {
    background: var(--bg-tertiary);
    border-color: var(--accent-dim);
}
.cdd-risk-dot {
    grid-area: dot;
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.cdd-risk-dot.cdd-risk-green  { background: var(--green); }
.cdd-risk-dot.cdd-risk-amber  { background: var(--yellow); }
.cdd-risk-dot.cdd-risk-red    { background: var(--red); }

.cdd-deal-title {
    grid-area: title;
    font-weight: 500;
    color: var(--text-bright);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cdd-deal-meta {
    grid-area: meta;
    color: var(--text-muted);
    font-size: 11px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.cdd-deal-money {
    grid-area: money;
    font-family: var(--mono);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    /* WHY: monospace + accent so money jumps to the eye in the
       deal list. Laurent reads the rail by money-first. */
}

/* ---- Focus pane ---- */
.cdd-focus {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px 20px;
    min-height: 320px;
}
.cdd-focus-empty {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    gap: 6px;
}
.cdd-focus-empty-text {
    font-size: 14px;
    color: var(--text-secondary);
}
.cdd-focus-empty-hint {
    font-size: 12px;
    color: var(--text-muted);
}
.cdd-focus-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}
.cdd-focus-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-bright);
    margin: 0 0 4px;
}
.cdd-focus-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
}
.cdd-focus-money {
    font-family: var(--mono);
    color: var(--accent);
    font-weight: 600;
}
.cdd-focus-open {
    font-size: 12px;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--accent-dim);
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none;
}
.cdd-focus-open:hover {
    background: var(--accent-dim);
    color: var(--text-bright);
}

.cdd-focus-section { margin: 8px 0 16px; }
.cdd-focus-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.cdd-focus-synthese {
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 13px;
}
.cdd-focus-empty-soft {
    color: var(--text-muted);
    font-style: italic;
}

.cdd-stub-badge {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 500;
}

.cdd-focus-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-top: 8px;
    margin-bottom: 8px;
}
.cdd-focus-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.cdd-focus-tab:hover { color: var(--text-bright); }
.cdd-focus-tab.is-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.cdd-activity-list { list-style: none; padding: 0; margin: 0; }
.cdd-activity-item {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.cdd-activity-when {
    font-family: var(--mono);
    color: var(--text-muted);
}
.cdd-activity-body { color: var(--text-primary); }

.cdd-activity-error {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 14px 16px;
}
.cdd-activity-error p {
    margin: 0 0 8px;
}
.cdd-activity-error-support {
    color: var(--text-muted);
    font-size: 12px;
}
.cdd-activity-error-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.cdd-activity-error-retry {
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
}
.cdd-activity-error-retry:hover {
    background: var(--accent-hover);
}

.cdd-notes-block {
    white-space: pre-wrap;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
}

/* ---- Leverage table (footer) ---- */
.cdd-leverage {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px 20px;
    margin-top: 8px;
}
.cdd-leverage-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 4px;
}
.cdd-leverage-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 0 10px;
    line-height: 1.4;
}
.cdd-leverage-scroll {
    overflow-x: auto;
    margin: 0 -8px;
    padding: 0 8px;
    /* WHY: horizontal scroll when the stage list is wide; the rep
       column stays sticky-left so the row never reads orphaned. */
}
.cdd-leverage-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 12px;
}
.cdd-leverage-table th,
.cdd-leverage-table td {
    border-bottom: 1px solid var(--border);
    padding: 6px 8px;
    text-align: right;
    /* WHY: numbers right-align so columns of euros line up by digit. */
}
.cdd-leverage-table thead th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: right;
}
.cdd-lev-rep-col,
.cdd-lev-rep {
    text-align: left !important;
    background: var(--bg-secondary);
    position: sticky;
    left: 0;
    z-index: 1;
    color: var(--text-bright);
    font-weight: 500;
}
.cdd-lev-cell {
    font-family: var(--mono);
}
.cdd-lev-cell-empty { color: var(--text-muted); }
.cdd-lev-cell-n {
    color: var(--text-bright);
    font-weight: 600;
    margin-right: 6px;
}
.cdd-lev-cell-eur { color: var(--accent); }
.cdd-lev-total {
    font-family: var(--mono);
    font-weight: 600;
    color: var(--text-bright);
    background: var(--bg-tertiary);
}
.cdd-lev-wr { font-family: var(--mono); }
.cdd-lev-wr-count {
    color: var(--text-muted);
    font-size: 11px;
    margin-left: 4px;
}
