/* edet-intelligence.css — Story Intelligence dashboard: tab bar, coherence
   score cards, deep-linkable findings list, severity dots, matrix tables and the
   who-appears-where list. Renders inside the shared overlay (#dr-overlay-body),
   alongside edet-reports.css. Tokens from site.css :root only. */

/* head: scope toggle + tabs, sticky atop the scrolling body */
.dr-intel-head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 0.25rem 0 0.6rem;
    margin-bottom: 0.6rem;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
}
.dr-tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; background: var(--bg-raised); border: 1px solid var(--rule); border-radius: 8px; }
/* the primary Insights switch (Stats | Analysis) — sits above the analysis scope/category rows */
.dr-insights-tabs { display: inline-flex; gap: 2px; padding: 2px; background: var(--bg-raised); border: 1px solid var(--rule); border-radius: 8px; margin: 0 0 0.7rem; }

/* shared content column — BOTH Insights tabs (Stats + Analysis) render inside this
   one centered, max-width column so the two tabs share an identical layout instead
   of one going full-bleed and the other being marooned in a narrow strip. */
.dr-insights { max-width: 64rem; margin: 0 auto; padding-bottom: 1.5rem; }
.dr-intel-body { display: flex; flex-direction: column; gap: 1rem; }
.dr-tab {
    height: 28px;
    padding: 0 0.7rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--fg-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--dur-fast) var(--ease-smooth), color var(--dur-fast) var(--ease-smooth);
}
.dr-tab:hover { color: var(--fg); }
.dr-tab[data-active="true"] { background: var(--accent-muted); color: var(--accent); }

/* coherence score chips (prose · structure · consistency) — same uniform grid as
   the metric cards so they line up under the health hero in BOTH tabs */
.dr-scores { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.6rem; }
.dr-score {
    padding: 0.9rem 1rem;
    border: 1px solid var(--rule);
    border-radius: 12px;
    background: var(--bg-raised);
    border-left: 3px solid var(--fg-dim);
}
.dr-score-val { font-family: var(--font-mono); font-size: var(--text-2xl, 1.6rem); line-height: 1; color: var(--fg); }
.dr-score-label { margin-top: 0.35rem; color: var(--fg-muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; }
.dr-score[data-band="good"] { border-left-color: var(--status-ok); }
.dr-score[data-band="warn"] { border-left-color: var(--status-warn); }
.dr-score[data-band="bad"]  { border-left-color: var(--status-err); }
.dr-score[data-band="good"] .dr-score-val { color: var(--status-ok); }
.dr-score[data-band="warn"] .dr-score-val { color: var(--status-warn); }
.dr-score[data-band="bad"]  .dr-score-val { color: var(--status-err); }

/* Manuscript health headline (P13) — shared by both Insights tabs */
.dr-health {
    display: flex; align-items: center; gap: 1rem;
    padding: 1rem 1.2rem;
    border: 1px solid var(--rule); border-left: 4px solid var(--fg-dim); border-radius: 12px;
    background: var(--bg-raised);
}
.dr-health-val { font-family: var(--font-mono); font-size: var(--text-3xl, 2.4rem); line-height: 1; color: var(--fg); }
.dr-health-title { color: var(--fg-muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; }
.dr-health-label { color: var(--fg); font-size: var(--text-base); font-weight: 600; }
.dr-health[data-band="good"] { border-left-color: var(--status-ok); } .dr-health[data-band="good"] .dr-health-val { color: var(--status-ok); }
.dr-health[data-band="warn"] { border-left-color: var(--status-warn); } .dr-health[data-band="warn"] .dr-health-val { color: var(--status-warn); }
.dr-health[data-band="bad"]  { border-left-color: var(--status-err); } .dr-health[data-band="bad"] .dr-health-val { color: var(--status-err); }
.dr-linkbtn { background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }

/* findings list (deep-linkable) */
.dr-find-list { list-style: none; margin: 0.3rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.dr-find-jump {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.6rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--fg);
    font-family: var(--font-mono);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-smooth);
}
.dr-find-jump:hover { background: var(--row-hover); }
.dr-find-jump[data-nojump] { cursor: default; }
.dr-find-jump[data-nojump]:hover { background: transparent; }
.dr-find-dot { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 0.45em; border-radius: 50%; background: var(--fg-dim); }
.dr-find[data-sev="high"] .dr-find-dot { background: var(--status-err); }
.dr-find[data-sev="med"]  .dr-find-dot { background: var(--status-warn); }
.dr-find[data-sev="low"]  .dr-find-dot { background: var(--accent); }
.dr-find[data-sev="info"] .dr-find-dot { background: var(--fg-dim); }
.dr-find-body { min-width: 0; }
.dr-find-msg { display: block; font-size: var(--text-sm); }
.dr-find-ex { display: block; margin-top: 0.15rem; color: var(--fg-muted); font-size: var(--text-xs); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-find { display: flex; align-items: flex-start; gap: 0.3rem; }
.dr-find .dr-find-jump { flex: 1 1 auto; }
.dr-find-ignore {
    flex: 0 0 auto;
    align-self: center;
    background: transparent;
    border: 1px solid var(--rule);
    border-radius: 6px;
    color: var(--fg-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    padding: 0.2rem 0.5rem;
    cursor: pointer;
}
.dr-find-ignore:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }

/* matrix / span / pov tables */
.dr-matrix-wrap { overflow-x: auto; margin-top: 0.3rem; }
.dr-matrix { border-collapse: collapse; font-family: var(--font-mono); font-size: var(--text-xs); }
.dr-matrix th, .dr-matrix td { padding: 0.3rem 0.55rem; border: 1px solid var(--rule); text-align: center; white-space: nowrap; }
.dr-matrix th { color: var(--fg-muted); background: var(--bg-raised); font-weight: 600; }
.dr-matrix tr th:first-child { text-align: left; color: var(--fg); }
.dr-matrix td { color: var(--fg); }
.dr-matrix td.dr-mz { color: var(--fg-deep); }

/* who-appears-where */
.dr-where { list-style: none; margin: 0.3rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.dr-where li { display: flex; gap: 0.75rem; padding: 0.35rem 0.5rem; border-radius: 6px; }
.dr-where li:hover { background: var(--row-hover); }
.dr-where-ch { flex: 0 0 9rem; color: var(--fg-muted); font-family: var(--font-mono); font-size: var(--text-xs); }
.dr-where-ppl { min-width: 0; color: var(--fg); font-size: var(--text-sm); }
