/* ==========================================================================
   DASHBOARD (index.html, static/js/dashboard/*)
   Builds on the shared dash-* primitives in styles.css (.dash-card, .pf-tabs,
   .dash-table, the pills and the narrative panel). New pieces are dsh-* (cards)
   and idr-* (discussion drawer), so nothing here reaches another page.
   ========================================================================== */

/* The calendar's quick add and editors read these; calendar.css sets them on
   .cal-page, which this page is not. */
body.dashboard-shell {
    --cal-line: rgba(255, 255, 255, 0.06);
    --cal-line-strong: rgba(255, 255, 255, 0.11);
    --cal-now: #ea4335;
    --cal-off: rgba(0, 0, 0, 0.22);
    --cal-hover: rgba(255, 255, 255, 0.035);
    --bar-h: 20px;
    --cal-radius: 8px;
    --pri-critical: #ef4444;
    --pri-high: #f97316;
    --pri-medium: #f59e0b;
    --pri-low: rgba(255, 255, 255, 0.22);
}

/* Card header: title left, controls right. */
.dashboard-shell .dash-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.dashboard-shell .row > [class*="col-"] > .dash-card { min-width: 0; }

/* ── Small shared pieces ── */
.dsh-muted { color: var(--text-light); font-size: var(--text-xs); }
.dsh-headlink { color: var(--text-light); font-size: var(--text-xs); font-weight: 600; text-decoration: none; }
.dsh-headlink:hover { color: #e9d6c3; }
.dsh-linkbtn {
    background: none; border: 0; padding: 0; color: #D9C4A8; font: inherit; text-decoration: underline;
    text-decoration-color: rgba(217, 196, 168, 0.4); text-underline-offset: 2px; cursor: pointer;
}
.dsh-linkbtn:hover { color: #fff; }
.dsh-crit-count { color: #f87171; font-weight: 700; }

.dsh-empty { text-align: center; padding: var(--space-6) var(--space-4); color: var(--text-light); }
.dsh-empty > i { font-size: 1.4rem; opacity: 0.5; margin-bottom: var(--space-2); display: block; }
.dsh-empty-title { color: var(--text-color); font-weight: 600; font-size: var(--text-sm); }
.dsh-empty-text { font-size: var(--text-xs); margin-top: 2px; }

.dsh-due {
    display: inline-flex; align-items: center; flex: none;
    font-size: 0.66rem; font-weight: 700; letter-spacing: 0.2px;
    padding: 1px 7px; border-radius: 999px; white-space: nowrap;
    background: rgba(255, 255, 255, 0.06); color: var(--text-light);
}
.dsh-due.is-overdue { background: rgba(239, 68, 68, 0.16); color: #fca5a5; }
.dsh-due.is-today { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.dsh-due.is-soon { background: rgba(140, 110, 82, 0.2); color: #E4D2BC; }

.dsh-ref {
    display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
    padding: 2px 8px; border-radius: 6px; font-size: 0.7rem; font-weight: 600;
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--surface-border);
    color: var(--text-color); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dsh-ref i { color: var(--accent-color); font-size: 0.65rem; }
a.dsh-ref:hover { border-color: rgba(140, 110, 82, 0.5); color: #fff; }

.dsh-icon-btn {
    width: 28px; height: 28px; flex: none; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 7px; border: 1px solid transparent; background: transparent;
    color: var(--text-light); font-size: 0.75rem; text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.dsh-icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: #fff; border-color: var(--surface-border-strong); }
.dsh-icon-btn.is-done:hover { background: rgba(16, 185, 129, 0.15); color: #34d399; border-color: rgba(16, 185, 129, 0.4); }
.dsh-icon-btn:disabled { opacity: 0.4; }

/* A compact .pf-tabs for chips that filter a list. */
.pf-tabs.dsh-chips { margin-bottom: var(--space-3); }
.pf-tabs.dsh-chips .pf-tab { padding: var(--space-2) var(--space-2); font-size: var(--text-sm); }

.dsh-more {
    display: block; width: 100%; margin-top: var(--space-2); padding: 6px;
    background: none; border: 1px dashed var(--surface-border-strong); border-radius: 8px;
    color: var(--text-light); font-size: var(--text-xs); font-weight: 600;
}
.dsh-more:hover { color: #fff; border-color: var(--accent-color); }

/* Category / priority additions to the shared pills. */
.dash-category-pill.cat-action { color: rgba(140, 110, 82, 0.22); }
.dash-category-pill.cat-action span { color: #E4D2BC; filter: none; }
.dash-priority-badge.pri-low { background: rgba(255, 255, 255, 0.06); color: var(--text-light); border-color: rgba(255, 255, 255, 0.12); }

/* ── Sidebar: Firm Pulse rows are buttons into Do next ── */
.dash-pulse-list button.dash-pulse-row {
    width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.dash-pulse-list button.dash-pulse-row:hover { border-color: rgba(140, 110, 82, 0.5); background: rgba(140, 110, 82, 0.08); }
.dash-pulse-list { gap: 6px; }
.dash-pulse-list .dash-pulse-row { padding: 6px var(--space-3); }

/* ── Do next ── */
.dsh-focus { display: flex; flex-direction: column; }
.dsh-focus-list { display: flex; flex-direction: column; gap: 6px; max-height: 520px; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.dsh-focus-row {
    display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: var(--space-3); align-items: start;
    padding: 9px var(--space-3); border-radius: 10px;
    background: var(--surface-2); border: 1px solid var(--surface-border);
    border-left: 3px solid var(--pri-low);
    transition: border-color var(--transition-fast), background var(--transition-fast), opacity 0.25s ease, transform 0.25s ease;
}
.dsh-focus-row.is-critical { border-left-color: var(--pri-critical); }
.dsh-focus-row.is-high { border-left-color: var(--pri-high); }
.dsh-focus-row.is-medium { border-left-color: var(--pri-medium); }
.dsh-focus-row:hover { background: rgba(140, 110, 82, 0.07); border-color: rgba(140, 110, 82, 0.35); }
.dsh-focus-row.is-critical:hover { border-left-color: var(--pri-critical); }
.dsh-focus-row.is-high:hover { border-left-color: var(--pri-high); }
.dsh-focus-row.is-medium:hover { border-left-color: var(--pri-medium); }
.dsh-focus-row.is-leaving { opacity: 0.35; transform: translateX(6px); }
.dsh-focus-icon {
    width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
    background: rgba(140, 110, 82, 0.14); color: #D9C4A8; font-size: 0.78rem;
}
.dsh-focus-main { min-width: 0; cursor: pointer; outline: none; }
.dsh-focus-main:focus-visible { box-shadow: 0 0 0 2px rgba(140, 110, 82, 0.5); border-radius: 6px; }
.dsh-focus-top { display: flex; align-items: center; gap: var(--space-2); }
.dsh-focus-title { color: #fff; font-weight: 600; font-size: var(--text-sm); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-focus-sub { color: var(--text-light); font-size: var(--text-xs); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-focus-refs { margin-top: 5px; display: flex; gap: 6px; flex-wrap: wrap; }
.dsh-focus-tools { display: flex; gap: 2px; opacity: 0.55; transition: opacity var(--transition-fast); }
.dsh-focus-row:hover .dsh-focus-tools, .dsh-focus-row:focus-within .dsh-focus-tools { opacity: 1; }

/* ── Schedule ── */
.dsh-schedule { display: flex; flex-direction: column; }
.dsh-sch-add {
    display: flex; align-items: center; gap: var(--space-2);
    padding: 0 var(--space-3); margin-bottom: var(--space-3);
    background: rgba(0, 0, 0, 0.25); border: 1px solid var(--surface-border-strong); border-radius: 10px;
}
.dsh-sch-add:focus-within { border-color: var(--accent-color); }
.dsh-sch-add i { color: var(--accent-color); font-size: 0.75rem; }
.dsh-sch-add input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: #fff; font-size: var(--text-sm); padding: 9px 0; }
.dsh-sch-add input::placeholder { color: var(--text-light); opacity: 0.8; }
.dsh-sch-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-bottom: var(--space-3); }
.dsh-sch-day {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px 7px; border-radius: 9px; cursor: pointer;
    background: var(--surface-2); border: 1px solid var(--surface-border); color: var(--text-light);
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.dsh-sch-day:hover { border-color: rgba(140, 110, 82, 0.45); color: #fff; }
.dsh-sch-day.is-weekend { background: rgba(0, 0, 0, 0.18); }
.dsh-sch-day.is-today .dsh-sch-dnum { color: #E4D2BC; }
.dsh-sch-day.is-selected { border-color: var(--accent-color); background: rgba(140, 110, 82, 0.16); color: #fff; }
.dsh-sch-dow { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.dsh-sch-dnum { font-size: 1.05rem; font-weight: 700; color: #fff; line-height: 1.1; }
.dsh-sch-dots { display: flex; gap: 3px; height: 6px; }
.dsh-sch-dots i { width: 6px; height: 6px; border-radius: 50%; display: block; }
.dsh-sch-dots i.is-none { background: transparent; }
.dsh-sch-n { position: absolute; top: 3px; right: 5px; font-size: 0.58rem; font-weight: 700; color: var(--text-light); }
.dsh-sch-warn { position: absolute; top: 5px; left: 6px; width: 6px; height: 6px; border-radius: 50%; background: #f59e0b; }
.dsh-sch-dayhead {
    display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2);
    color: #fff; font-weight: 600; font-size: var(--text-sm); margin-bottom: var(--space-2);
}
.dsh-sch-dayhead a { text-decoration: none; }
.dsh-sch-dayhead a:hover { color: #fff; }
.dsh-sch-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; }
.dsh-sch-item {
    display: flex; align-items: center; gap: var(--space-2);
    padding: 6px var(--space-2); border-radius: 8px; border-left: 3px solid var(--c, var(--accent-color));
    background: rgba(255, 255, 255, 0.025);
}
.dsh-sch-item:hover { background: rgba(255, 255, 255, 0.05); }
.dsh-sch-item.is-done .dsh-sch-title { text-decoration: line-through; color: var(--text-light); }
.dsh-sch-item.is-late { background: rgba(239, 68, 68, 0.06); }
.dsh-sch-ico, .dsh-sch-check { width: 24px; flex: none; text-align: center; color: var(--c, var(--text-light)); font-size: 0.78rem; }
.dsh-sch-check { background: none; border: 0; padding: 0; cursor: pointer; font-size: 0.9rem; }
.dsh-sch-check:hover { color: #34d399; }
.dsh-sch-body { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; }
.dsh-sch-title { color: #fff; font-size: var(--text-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-sch-sub { color: var(--text-light); font-size: 0.7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-sch-free { color: var(--text-light); font-size: var(--text-xs); padding: var(--space-4) var(--space-2); text-align: center; }
.dsh-sch-free i { margin-right: 6px; opacity: 0.7; }
.dsh-sch-heads { margin-top: var(--space-3); border-top: 1px solid var(--surface-border); padding-top: var(--space-2); }
.dsh-sch-heads:empty { display: none; }
.dsh-sch-heads-title { font-size: var(--text-xs); font-weight: 700; color: var(--text-light); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.dsh-sch-head { display: flex; gap: var(--space-2); font-size: 0.72rem; padding: 3px 0; color: var(--text-color); line-height: 1.35; cursor: default; }
.dsh-sch-head[data-day] { cursor: pointer; }
.dsh-sch-head i { margin-top: 2px; }
.dsh-sch-head.is-danger i { color: #f87171; }
.dsh-sch-head.is-warning i { color: #fbbf24; }
.dsh-sch-head.is-info i { color: #67d6ef; }
.dsh-sch-head > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-sch-more { display: inline-block; margin-top: 2px; text-decoration: none; }

/* ── Strategic Intelligence ── */
.dsh-brief-status { display: flex; align-items: center; gap: var(--space-2); color: var(--text-light); font-size: var(--text-xs); }
.dsh-stale { color: #fcd34d; }
.pf-tabs.dsh-brief-modes { margin-bottom: var(--space-3); }
.dsh-brief-note { padding: var(--space-2) var(--space-5); font-size: var(--text-xs); color: #fde68a; background: rgba(245, 158, 11, 0.08); border-bottom: 1px solid var(--surface-border); }
.dsh-brief-error { color: var(--text-light); font-size: var(--text-sm); }
.dsh-strip-sub { font-size: 0.66rem; color: var(--text-light); opacity: 0.8; }
#dash-intel .dash-narrative-capital-strip { flex-wrap: wrap; row-gap: var(--space-3); }
#dash-intel .dash-narrative-body { max-height: 540px; min-height: 120px; }
#dash-intel .dash-ask-bar { border-bottom: 0; padding-bottom: 0; margin-bottom: var(--space-3); }

/* Findings */
.dsh-fd-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.dsh-fd-head .pf-tabs { flex: 1 1 auto; margin-bottom: var(--space-3); }
.dsh-fd-tools { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.dsh-mix { display: flex; width: 180px; height: 22px; border-radius: 6px; overflow: hidden; gap: 2px; }
.dsh-mix-seg {
    min-width: 22px; border: 0; padding: 0; font-size: 0.62rem; font-weight: 800; color: rgba(0, 0, 0, 0.75);
    opacity: 0.75; transition: opacity var(--transition-fast), box-shadow var(--transition-fast);
}
.dsh-mix-seg:hover, .dsh-mix-seg.is-on { opacity: 1; }
.dsh-mix-seg.is-on { box-shadow: inset 0 0 0 2px #fff; }
.dsh-mix-seg.is-critical { background: var(--pri-critical); color: #fff; }
.dsh-mix-seg.is-high { background: var(--pri-high); }
.dsh-mix-seg.is-medium { background: var(--pri-medium); }
.dsh-mix-seg.is-low { background: #6b7280; color: #fff; }
.dsh-fd-scroll { max-height: 460px; overflow-y: auto; }
.dsh-fd-table thead th { position: sticky; top: 0; z-index: 1; background: #161616; }
.dsh-fd-row { cursor: pointer; }
.dsh-fd-row:focus-visible { outline: 2px solid rgba(140, 110, 82, 0.6); outline-offset: -2px; }
.dsh-fd-title { color: #fff; font-weight: 600; font-size: var(--text-sm); display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.dsh-fd-detail { color: var(--text-light); font-size: var(--text-xs); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dsh-fd-tools-cell { white-space: nowrap; }
.dsh-fd-tools-cell .dsh-icon-btn { opacity: 0.55; }
.dsh-fd-row:hover .dsh-icon-btn, .dsh-fd-row:focus-within .dsh-icon-btn { opacity: 1; }
.dsh-fd-foot { margin-top: var(--space-2); font-size: 0.7rem; color: var(--text-light); opacity: 0.85; }

/* ── Discussion drawer ── */
.insight-drawer.idr { width: min(580px, 100vw); }
.idr-header { align-items: flex-start; }
.idr-head-main { min-width: 0; }
.idr-head-main h5 { margin-top: var(--space-2) !important; line-height: 1.35; }
.idr-badges { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.idr-badges .dash-category-pill, .idr-badges .dash-priority-badge { width: auto; min-width: 0; }
.idr-actions {
    display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center;
    padding: var(--space-3) var(--space-6); border-bottom: 1px solid var(--surface-border); background: var(--surface-1);
}
.idr-body { gap: var(--space-4); }
.idr-sec:empty { display: none; }
.idr-sec-title {
    font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--accent-color); margin-bottom: var(--space-2); display: flex; justify-content: space-between;
}
.idr-src { color: var(--text-light); text-transform: none; letter-spacing: 0; font-weight: 600; }
.idr-detail { color: #fff; font-size: var(--text-sm); margin: 0 0 var(--space-2); line-height: 1.5; }
.idr-evidence { margin: 0; padding-left: 1.1rem; font-size: var(--text-xs); color: var(--text-color); }
.idr-evidence li { margin-bottom: 3px; }
.idr-related { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: var(--space-2); }
.idr-related-label { font-size: 0.68rem; color: var(--text-light); font-weight: 700; margin-right: 2px; }
.idr-record-head {
    display: flex; align-items: center; gap: var(--space-2); padding: 8px var(--space-3); margin-bottom: var(--space-2);
    border-radius: 9px; background: var(--surface-2); border: 1px solid var(--surface-border);
    color: #fff; font-weight: 700; font-size: var(--text-sm); text-decoration: none;
}
.idr-record-head:hover { border-color: rgba(140, 110, 82, 0.5); color: #fff; }
.idr-record-head > i:first-child { color: var(--accent-color); }
.idr-record-head .idr-go { margin-left: auto; font-size: 0.7rem; color: var(--text-light); }
.idr-facts { list-style: none; margin: 0 0 var(--space-2); padding: 0; font-size: var(--text-xs); color: var(--text-color); }
.idr-facts li { padding: 2px 0; }
.idr-part { border: 1px solid var(--surface-border); border-radius: 8px; margin-bottom: 6px; background: rgba(255, 255, 255, 0.015); }
.idr-part summary {
    cursor: pointer; padding: 6px var(--space-3); font-size: var(--text-xs); font-weight: 700; color: #fff;
    display: flex; align-items: center; gap: var(--space-2); list-style: none;
}
.idr-part summary::-webkit-details-marker { display: none; }
.idr-part summary::before {
    content: ''; width: 5px; height: 5px; flex: none; margin-right: 2px;
    border-right: 1.5px solid var(--text-light); border-bottom: 1.5px solid var(--text-light);
    transform: rotate(-45deg); transition: transform 0.15s ease;
}
.idr-part[open] summary::before { transform: rotate(45deg); }
.idr-part-n { margin-left: auto; font-size: 0.62rem; color: var(--text-light); background: var(--surface-2); border-radius: 999px; padding: 0 7px; }
.idr-part ul { margin: 0; padding: 0 var(--space-3) var(--space-2) 1.6rem; font-size: 0.72rem; color: var(--text-color); }
.idr-part li { margin-bottom: 3px; overflow-wrap: anywhere; }
.idr-history-note { font-size: 0.7rem; color: var(--text-light); display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.idr-msg { padding: 10px 14px; border-radius: 12px; font-size: var(--text-sm); line-height: 1.55; margin-bottom: var(--space-2); max-width: 92%; overflow-wrap: anywhere; }
.idr-msg.is-user { margin-left: auto; background: rgba(140, 110, 82, 0.28); color: #fff; border-bottom-right-radius: 4px; }
.idr-msg.is-ai { background: var(--surface-2); border: 1px solid var(--surface-border); color: var(--text-color); border-bottom-left-radius: 4px; }
.idr-msg.is-error { border-color: rgba(239, 68, 68, 0.35); color: #fca5a5; }
.idr-msg p { margin: 0 0 var(--space-2); }
.idr-msg p:last-child, .idr-msg ul:last-child, .idr-msg ol:last-child { margin-bottom: 0; }
.idr-msg ul, .idr-msg ol { padding-left: 1.2rem; margin: 0 0 var(--space-2); }
.idr-msg h2, .idr-msg h3, .idr-msg h4 { font-size: var(--text-sm); font-weight: 700; color: #fff; margin: var(--space-2) 0 4px; }
.idr-msg strong { color: #fff; }
.idr-msg-meta { margin-top: 6px; font-size: 0.62rem; color: var(--text-light); opacity: 0.7; }
.idr-footer { padding-top: var(--space-3); }
.idr-ask { display: flex; gap: var(--space-2); align-items: flex-end; }
.idr-ask textarea {
    flex: 1; resize: none; min-height: 38px; max-height: 140px; padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3); border: 1px solid var(--surface-border-strong); border-radius: 10px;
    color: #fff; font-size: var(--text-sm); outline: none;
}
.idr-ask textarea:focus { border-color: var(--accent-color); }
.idr-ask .btn { height: 38px; width: 42px; }
.idr-ask.is-off textarea { opacity: 0.6; }
.idr-hint { margin-top: 6px; font-size: 0.65rem; color: var(--text-light); opacity: 0.7; }

/* ── Outlook ── */
.dsh-late { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: var(--space-3); }
.dsh-late-label { font-size: var(--text-xs); font-weight: 700; color: var(--text-light); margin-right: 4px; display: inline-flex; gap: 6px; align-items: center; }
.dsh-late-chip {
    font-size: 0.7rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--surface-border); color: var(--text-light);
}
.dsh-late-chip.is-alert { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.35); color: #fca5a5; cursor: pointer; }
.dsh-late-chip.is-alert:hover { background: rgba(239, 68, 68, 0.2); color: #fff; }
.dsh-late-chip:disabled { opacity: 0.6; cursor: default; }
/* --ol-cols: the number of horizons (Settings → Dashboard), set by outlook.js */
.dsh-ol-grid { display: grid; grid-template-columns: repeat(var(--ol-cols, 3), minmax(0, 1fr)); gap: var(--space-3); }
.dsh-ol-col { background: var(--surface-2); border: 1px solid var(--surface-border); border-radius: 10px; padding: var(--space-3); min-width: 0; }
.dsh-ol-head { font-size: var(--text-sm); font-weight: 700; color: #fff; margin-bottom: var(--space-2); display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.dsh-ol-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 6px; align-items: baseline; padding: 4px 0; font-size: var(--text-xs); border-top: 1px solid rgba(255, 255, 255, 0.03); }
.dsh-ol-row i { color: var(--text-light); font-size: 0.68rem; text-align: center; }
.dsh-ol-label { color: var(--text-light); }
.dsh-ol-value { color: #fff; font-weight: 700; text-align: right; }
.dsh-ol-row.is-zero .dsh-ol-value { color: var(--text-light); font-weight: 500; opacity: 0.7; }
.dsh-ol-row.is-hot .dsh-ol-value { color: #E4D2BC; }
.dsh-ol-sub { grid-column: 2 / -1; font-size: 0.68rem; color: var(--text-light); line-height: 1.4; }
.dsh-ol-sub a { color: #D9C4A8; text-decoration: none; }
.dsh-ol-sub a:hover { color: #fff; text-decoration: underline; }
.dsh-ol-warn {
    margin-top: var(--space-3); display: flex; gap: var(--space-2); align-items: flex-start;
    padding: 8px var(--space-3); border-radius: 9px; font-size: var(--text-xs);
    background: rgba(245, 158, 11, 0.07); border: 1px solid rgba(245, 158, 11, 0.25); color: var(--text-color);
}
.dsh-ol-warn > i { color: #fbbf24; margin-top: 2px; }
.dsh-ol-warn a { color: #fde68a; }
.dsh-mo-head { margin: var(--space-4) 0 var(--space-2); font-size: var(--text-sm); font-weight: 700; color: #fff; display: flex; gap: var(--space-2); align-items: baseline; }
.dsh-mo-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-2); }
.dsh-mo-tile { background: var(--surface-2); border: 1px solid var(--surface-border); border-radius: 9px; padding: 8px 10px; min-width: 0; }
.dsh-mo-label { font-size: 0.66rem; color: var(--text-light); font-weight: 600; display: flex; gap: 5px; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsh-mo-value { font-size: var(--text-lg); font-weight: 700; color: #fff; line-height: 1.2; margin-top: 2px; }
.dsh-mo-delta { font-size: 0.64rem; font-weight: 700; display: flex; gap: 4px; align-items: center; white-space: nowrap; overflow: hidden; }
.dsh-mo-delta.is-up { color: #34d399; }
.dsh-mo-delta.is-down { color: #fca5a5; }
.dsh-mo-delta.is-flat { color: var(--text-light); }
.dsh-mo-delta .dsh-muted { font-size: 0.6rem; font-weight: 500; }

/* ── Corporate structures ── */
.dsh-st-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-bottom: var(--space-3); }
.dsh-st-stat { background: var(--surface-2); border: 1px solid var(--surface-border); border-radius: 8px; padding: 6px 8px; text-align: center; min-width: 0; }
.dsh-st-stat b { display: block; font-size: var(--text-md); color: #fff; }
.dsh-st-stat span { display: block; font-size: 0.6rem; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsh-st-stat.is-bad b { color: #f87171; }
.dsh-st-stat.is-warn b { color: #fbbf24; }
.dsh-st-missing {
    width: 100%; display: flex; align-items: center; gap: var(--space-2); text-align: left;
    padding: 7px var(--space-3); margin-bottom: var(--space-3); border-radius: 9px;
    background: rgba(13, 202, 240, 0.06); border: 1px solid rgba(13, 202, 240, 0.25); color: var(--text-color); font-size: var(--text-xs);
}
.dsh-st-missing:hover { background: rgba(13, 202, 240, 0.12); color: #fff; }
.dsh-st-missing > i:first-child { color: #67d6ef; }
.dsh-st-list { display: flex; flex-direction: column; gap: 6px; max-height: 470px; overflow-y: auto; overscroll-behavior: contain; }
.dsh-st-row { padding: 8px var(--space-3); border-radius: 9px; background: rgba(255, 255, 255, 0.025); border: 1px solid var(--surface-border); }
.dsh-st-top { display: flex; align-items: center; gap: var(--space-2); }
.dsh-st-name { flex: 1; min-width: 0; color: #fff; font-weight: 600; font-size: var(--text-sm); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-st-name:hover { color: #E4D2BC; }
.dsh-st-badge { flex: none; font-size: 0.64rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; background: none; }
.dsh-st-badge.is-bad { background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.35); color: #fca5a5; cursor: pointer; }
.dsh-st-badge.is-warn { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.3); color: #fcd34d; }
.dsh-st-badge.is-warn[data-finding] { cursor: pointer; }
.dsh-st-badge.is-ok { color: #34d399; background: rgba(16, 185, 129, 0.1); }
.dsh-st-meta { font-size: 0.7rem; color: var(--text-light); margin-top: 3px; }
.dsh-st-renew i { margin-right: 4px; }
.dsh-st-renew.is-warn { color: #fcd34d; }
.dsh-st-renew.is-bad { color: #fca5a5; }
.dsh-st-issue { font-size: 0.68rem; color: #fca5a5; opacity: 0.85; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-st-deals { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }

/* ── Capital raising ── */
.dsh-capital { height: 100%; display: flex; flex-direction: column; }
.dsh-cap-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-2); }
.dsh-cap-title { color: #fff; font-weight: 700; font-size: var(--text-sm); display: flex; gap: var(--space-2); align-items: center; }
.dsh-cap-title i { color: var(--accent-color); }
.dsh-cap-total { font-size: var(--text-sm); color: var(--text-color); margin-bottom: var(--space-2); }
.dsh-cap-total b { color: #fff; }
.dsh-cap-list { display: flex; flex-direction: column; gap: 6px; max-height: 380px; overflow-y: auto; overscroll-behavior: contain; }
.dsh-cap-row { padding: 8px var(--space-3); border-radius: 9px; background: var(--surface-2); border: 1px solid var(--surface-border); }
.dsh-cap-top { display: flex; align-items: baseline; gap: var(--space-2); }
.dsh-cap-name { flex: 1; min-width: 0; color: #fff; font-weight: 600; font-size: var(--text-sm); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-cap-name:hover { color: #E4D2BC; }
.dsh-cap-stage { font-size: 0.64rem; color: var(--text-light); white-space: nowrap; }
.dsh-cap-need { font-weight: 700; color: #fff; font-size: var(--text-sm); white-space: nowrap; }
.dsh-cap-bar { position: relative; height: 6px; margin: 6px 0; border-radius: 999px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.dsh-cap-bar span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.dsh-cap-bar .is-hard { background: rgba(140, 110, 82, 0.55); }
.dsh-cap-bar .is-committed { background: #10b981; }
.dsh-cap-meta { display: flex; align-items: center; gap: var(--space-2); font-size: 0.7rem; color: var(--text-light); flex-wrap: wrap; }
.dsh-cap-meta a { text-decoration: none; }
.dsh-cap-meta a:hover { color: #fff; }
.dsh-cap-none { color: #fcd34d; }
.dsh-cap-warm {
    display: inline-flex; gap: 5px; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 0.66rem; font-weight: 700;
    background: rgba(249, 115, 22, 0.12); border: 1px solid rgba(249, 115, 22, 0.35); color: #fdba74;
}
.dsh-cap-warm:hover { background: rgba(249, 115, 22, 0.22); color: #fff; }

/* ── Popup menu (static/js/dashboard/actions.js) ── */
.dsh-menu {
    position: fixed; z-index: 1300; min-width: 190px; padding: 5px;
    background: #1d1d1d; border: 1px solid var(--surface-border-strong); border-radius: 10px;
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.85);
}
.dsh-menu-item {
    display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 0; border-radius: 7px;
    background: none; color: var(--text-color); font-size: var(--text-xs); font-weight: 600; text-align: left;
}
.dsh-menu-item i { width: 14px; text-align: center; color: var(--text-light); }
.dsh-menu-item:hover, .dsh-menu-item:focus-visible { background: rgba(140, 110, 82, 0.16); color: #fff; outline: none; }
.dsh-menu-item.is-danger { color: #fca5a5; }
.dsh-menu-sep { height: 1px; margin: 4px 2px; background: var(--surface-border); }

/* ── News ── */
.dsh-news { max-height: 380px; }

/* ── Layout at narrower widths ── */
@media (max-width: 1399px) {
    .dsh-mo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 991px) {
    .dsh-ol-grid { grid-template-columns: 1fr; }
    .dsh-st-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dsh-fd-tools { width: 100%; }
    .dsh-fd-tools .dash-feed-search { flex: 1; }
    .dsh-fd-tools .dash-feed-search input { width: 100%; }
}
@media (max-width: 575px) {
    .dsh-mo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dsh-sch-week { gap: 3px; }
    .dsh-sch-dow { font-size: 0.55rem; }
    .dsh-fd-table th:nth-child(3), .dsh-fd-table td:nth-child(3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .dsh-focus-row, .dsh-icon-btn, .dsh-sch-day, .dsh-mix-seg { transition: none; }
}

/* Schedule: the folded overdue line under the day's items. */
.dsh-sch-late {
    display: flex; align-items: center; gap: var(--space-2); width: 100%; margin-top: 4px;
    padding: 6px var(--space-2); border-radius: 8px; text-align: left;
    background: rgba(239, 68, 68, 0.07); border: 1px dashed rgba(239, 68, 68, 0.3);
    color: #fca5a5; font-size: var(--text-xs); font-weight: 700;
}
.dsh-sch-late:hover { background: rgba(239, 68, 68, 0.12); }

/* Recent offerings beside "Raising now": the name column keeps a readable width
   and the table scrolls sideways before it squeezes. */
.dsh-offer-table { min-width: 560px; }
.dsh-offer-table td:first-child { min-width: 200px; }
.dsh-offer-table td:last-child a { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* Narrow screens: the sidebar sits on top as a two-column grid (the old 240px cap
   hid Firm Pulse entirely), and Do next rows wrap their titles and put the
   buttons on their own line instead of squeezing the title to a few letters. */
@media (max-width: 992px) {
    .dashboard-shell .dash-sidebar { max-height: none; overflow: visible; gap: var(--space-4); }
    .dashboard-shell .dash-kpi-mini-list,
    .dashboard-shell .dash-pulse-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
}
@media (max-width: 575px) {
    .dsh-focus-row { grid-template-columns: 26px minmax(0, 1fr); gap: var(--space-2); }
    .dsh-focus-icon { width: 26px; height: 26px; }
    .dsh-focus-top { flex-wrap: wrap; row-gap: 3px; }
    .dsh-focus-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .dsh-focus-tools { grid-column: 2; opacity: 1; justify-content: flex-end; margin-top: -2px; }
    .dash-main-scroll { padding: var(--space-3); }
}

/* Firm Pulse grew to six rows; on a 768px laptop screen the never-scrolling
   sidebar tightens its spacing first (styles.css drops the context lines below 760px). */
@media (min-width: 993px) and (max-height: 860px) {
    .dashboard-shell .dash-sidebar { gap: var(--space-4); padding-top: var(--space-4); padding-bottom: var(--space-3); }
    .dashboard-shell .dash-sidebar-title { margin-bottom: var(--space-2); }
    .dashboard-shell .dash-kpi-mini-list { gap: 6px; }
    .dash-pulse-list { gap: 4px; }
    .dash-pulse-list .dash-pulse-row { padding: 4px var(--space-3); }
    .dash-pulse-list .dash-pulse-value { font-size: var(--text-sm); }
}
