/* ===========================================
   Detail pages: incident (incident_detail.html), message (message.html) and
   member (user.html); macros in projects/_detail_macros.html.
   A main column of cards beside a 340px side column. A card opens with a micro
   title; facts read as "label … value" rows, scores as meter rows.
   =========================================== */

.dt-page { display: flex; flex-direction: column; gap: var(--gap); }
.dt-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-bottom: -6px; color: var(--label-2); font-size: 13px; text-decoration: none; }
.dt-back:hover { color: var(--label-1); }
.dt-id { font: 500 20px var(--font-mono); letter-spacing: 0; color: var(--label-3); }
.dt-handle { font-size: 20px; font-weight: 400; letter-spacing: 0; color: var(--label-3); }
/* The head's Actions menu: a full-size button */
.dt-page .page-head .row-menu > .btn { height: 30px; padding: 0 12px; font-size: 13.5px; border-radius: var(--r-md); }
.dt-page .page-head .row-menu > .popover { min-width: 240px; }

.dt-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--gap); align-items: start; }
.dt-col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }

/* ---------- Cards ---------- */
.dt-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dt-card-head { display: flex; align-items: center; gap: 8px; min-height: 18px; }
.dt-card-head .status-icon { --si-size: 20px; }
.dt-card-aside { margin-left: auto; font-size: 12.5px; color: var(--label-3); text-align: right; }
.dt-count { display: inline-grid; place-items: center; min-width: 18px; height: 16px; padding: 0 5px; border-radius: var(--r-xs); background: var(--fill-2); color: var(--label-2); font: 500 11px var(--font-mono); }
.dt-card-foot { padding-top: 10px; border-top: 1px solid var(--hairline); font-size: 12.5px; }
.dt-ai-mark { width: 13px; height: 13px; color: var(--ai); }

/* Rows that run edge to edge (message lists) */
.dt-flush { display: flex; flex-direction: column; padding: 0; }
.dt-flush > .dt-card-head { padding: 14px 16px 10px; }
.dt-flush > .msg-list { margin: 0; padding: 0 8px 6px; }
.dt-flush > .msg-list > .msg-context-focused { margin: 2px 0; }
.dt-flush > .msg-list > .flood-msg-group { margin: 6px 8px 2px; }
.dt-flush > .dt-card-foot { padding: 10px 16px 12px; }

/* The message itself, larger than a list row */
.dt-hero { display: flex; flex-direction: column; gap: 12px; }
.dt-hero > .msg-list > .msg-item { column-gap: 14px; }
.dt-hero .msg-avatar { width: 36px; height: 36px; font-size: 14px; }
.dt-hero .msg-text { font-size: 15px; line-height: 1.6; }
.dt-text { margin: 0; font-size: 15px; line-height: 1.6; color: var(--label-body); white-space: pre-wrap; overflow-wrap: anywhere; }
.dt-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-top: 12px; border-top: 1px solid var(--hairline); font-size: 12.5px; color: var(--label-3); }
.dt-facts b { color: var(--label-2); font-weight: 500; }
.dt-facts .mono { font-family: var(--font-mono); font-size: 12px; }

/* A person: avatar, name, then dates or handles */
.dt-author { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dt-author > .avatar { width: 36px; height: 36px; font-size: 14px; }
.dt-author-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dt-author-name { color: var(--label-1); font-size: 14px; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
a.dt-author-name:hover { text-decoration: underline; }
.dt-author-name .name-handle { font-weight: 400; color: var(--label-3); }
.dt-author > .act-tag, .dt-author > .dt-restriction { margin-left: auto; }
.dt-author .user-dates { margin: 0; gap: 0 12px; font-size: 12.5px; }
.dt-author .user-date dt { font-size: 12.5px; text-transform: none; letter-spacing: 0; color: var(--label-3); }
.dt-author .user-date dd { font-weight: 400; color: var(--label-2); }

/* "Label … value" rows */
.dt-kvs { display: flex; flex-direction: column; gap: 6px; }
.dt-kv { display: flex; align-items: center; gap: 8px; min-height: 24px; font-size: 13.5px; }
.dt-kv > :first-child { color: var(--label-2); }
.dt-kv > :last-child { margin-left: auto; color: var(--label-1); font-weight: 500; text-align: right; }
.dt-kv .state { color: var(--label-1); }
.dt-kv > .tone-text { color: var(--tone-bold); }
.dt-kv > .neg { color: var(--red); }
.dt-restriction { display: inline-flex; align-items: center; gap: 8px; }
.dt-restriction .countdown { font-size: 12px; font-weight: 400; color: var(--label-3); }

/* "Label ——meter—— value" rows */
.dt-score { display: grid; grid-template-columns: 110px minmax(0, 1fr) 40px; gap: 10px; align-items: center; min-height: 24px; font-size: 13px; color: var(--label-2); }
.dt-score b { text-align: right; font-weight: 500; color: var(--label-1); font-variant-numeric: tabular-nums; }
.dt-score b.pos { color: var(--green); }
.dt-score b.neg { color: var(--red); }
.dt-score b.warn { color: var(--amber); }
.dt-meter { height: 4px; border-radius: 2px; background: var(--fill-2); overflow: hidden; }
.dt-meter i { display: block; height: 100%; border-radius: 2px; background: var(--dv-volume); }
.dt-meter i.pos { background: var(--green); }
.dt-meter i.neg { background: var(--red); }
.dt-meter i.warn { background: var(--amber); }
button.dt-score, a.dt-score { width: calc(100% + 12px); margin: 0 -6px; padding: 0 6px; border: 0; border-radius: var(--r-sm); background: none; font: inherit; font-size: 13px; text-align: left; color: var(--label-2); cursor: pointer; }
button.dt-score:hover, a.dt-score:hover, .dt-score.is-on { background: var(--fill-1); color: var(--label-1); }

/* Words: why, notes, rules, chips */
.dt-why { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--label-body); }
.dt-why strong { color: var(--label-1); font-weight: 500; }
.dt-note { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--label-2); }
.dt-note strong { color: var(--label-1); font-weight: 500; }
.dt-rules { display: flex; flex-wrap: wrap; align-items: baseline; }
.dt-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dt-chips > .micro { margin-right: 4px; }
.dt-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1px solid var(--hairline); border-radius: var(--r-sm); color: var(--label-3); font-size: 12px; }
.dt-chip.is-on { border-color: var(--line-strong); background: var(--fill-1); color: var(--label-1); }
.dt-chip.is-bad { border-color: transparent; background: var(--red-tint); color: var(--red); }
.dt-matches ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--label-body); }
.dt-matches code { font-size: 12px; }

/* The bot asks an admin: a quiet box with the reasons and what was done */
.dt-ask { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--fill-1); }
.dt-ask ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--label-2); }
.dt-ask li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.dt-state { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; }
.dt-state .dt-why { flex-basis: 100%; }

/* Roles: tags, then dashed "+ role" buttons */
.dt-roles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 12px; border-top: 1px solid var(--hairline); }
.dt-roles > .micro { margin-right: 4px; }
.dt-roles .role-add-btn { height: 24px; padding: 0 8px; font-size: 12px; border-color: var(--line-strong); color: var(--label-2); }

/* What happened: one row per detection */
.dt-hits { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.dt-hits li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--hairline-soft); }
.dt-hits li:first-child { padding-top: 0; border-top: 0; }
.dt-hits li:last-child { padding-bottom: 0; }
.dt-hit-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dt-hit-top { display: flex; flex-wrap: wrap; align-items: baseline; font-size: 13.5px; color: var(--label-2); }
.dt-hit-top strong { color: var(--label-1); font-weight: 500; }
.dt-hit-outcome { color: var(--label-1); }

/* Timeline */
.dt-tl { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.dt-tl li { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 6px 0; font-size: 13.5px; color: var(--label-body); }
.dt-tl li + li::before { content: ''; position: absolute; left: 10.5px; top: -6px; height: 12px; width: 1px; background: var(--hairline); }
.dt-tl-ico { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--fill-1); color: var(--label-2); }
.dt-tl-ico > svg { width: 12px; height: 12px; }
.dt-tl-ico .status-icon { --si-size: 22px; border-radius: 50%; }
.dt-tl-what { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; padding-top: 2px; }
.dt-tl-name { color: var(--label-1); }
.dt-tl li > span:nth-child(2):not(.dt-tl-what) { padding-top: 2px; }
.dt-tl-time { padding-top: 3px; font-size: 12px; color: var(--label-2); white-space: nowrap; text-align: right; }
.dt-tl li.revoked .dt-tl-name { text-decoration: line-through; color: var(--label-2); }

/* Attached images */
.dt-images > summary { list-style: none; cursor: pointer; }
.dt-images > summary::-webkit-details-marker { display: none; }
.dt-images > summary::after { content: none; }
.dt-images-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dt-images-grid .image-thumb { all: unset; cursor: zoom-in; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--hairline); }
.dt-images-grid img { display: block; width: 140px; height: 140px; object-fit: cover; }

/* Flood strip, surge chips and the impersonation comparison inside a v6 card */
.dt-page .flood-strip { margin: 0; }
.dt-page .flood-facts { margin: 0; color: var(--label-2); }
.dt-page .surge-triggered-by { margin: 0; }
.dt-page .surge-chip { border-color: var(--hairline); background: var(--fill-1); }
.dt-page .impersonation-signals { margin: 0; color: var(--label-body); }

/* ---------- Message page ---------- */
.dt-avatar-link { display: inline-flex; flex-shrink: 0; text-decoration: none; }
.dt-avatar-link > .avatar { width: 36px; height: 36px; font-size: 14px; }
.dt-author-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.dt-author-tags { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.dt-hero.is-deleted .dt-text { color: var(--label-2); }
.dt-hero .msg-quote { margin: 0; }
.dt-hero .message-incident-media { margin: 0; }
.dt-reactions .reaction-pills { margin: 0; }
.dt-joined { white-space: normal; }
.dt-author .identity-chips { font-size: 12.5px; }
.dt-recent { display: flex; flex-direction: column; }
.dt-recent > .micro { padding-bottom: 4px; }
.dt-recent-item { display: flex; flex-direction: column; gap: 2px; margin: 0 -6px; padding: 8px 6px; border-top: 1px solid var(--hairline-soft); border-radius: var(--r-sm); color: inherit; text-decoration: none; }
.dt-recent > .micro + .dt-recent-item { border-top: 0; }
.dt-recent-item:hover { background: var(--hover-tint); }
.dt-recent-top { display: flex; flex-wrap: wrap; align-items: baseline; font-size: 12px; color: var(--label-3); }
.dt-recent-text { font-size: 13px; line-height: 1.45; color: var(--label-body); overflow-wrap: anywhere; }
.dt-open-in { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; }
.dt-open-in .btn { width: 100%; justify-content: center; }
.message-incident { position: relative; cursor: pointer; }
.message-incident .card-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.message-incident:hover { border-color: var(--line-strong); }
.message-incident .status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.message-incident .status-row, .message-incident .status-icon { position: relative; z-index: 2; }

/* ---------- Member page ---------- */
.dt-profile > .dt-author { align-items: flex-start; }
.dt-profile > .dt-author > .avatar { width: 44px; height: 44px; font-size: 16px; }
.dt-profile .dt-author-meta { gap: 6px; padding-top: 2px; }
.dt-author-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.dt-author-line .identity-chips { font-size: 13px; color: var(--label-2); }
.dt-record { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--label-3); }
.dt-record b { color: var(--label-1); font-weight: 500; }
.dt-kpis .kpi-value.pos { color: var(--green); }
.dt-kpis .kpi-value.neg { color: var(--red); }
.dt-chart-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.dt-chart-range { font-size: 12.5px; }
.dt-type-tabs { margin-left: auto; }
.dt-line-key { display: inline-block; width: 12px; height: 2px; border-radius: 1px; background: var(--label-1); }
.dt-bar-key { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--dv-volume-2); }
.dt-chart { position: relative; height: 200px; }
.dt-empty { margin: 0; padding: 8px 0; font-size: 13px; color: var(--label-3); }
.dt-flush .dt-empty { padding: 4px 16px 16px; }
.dt-messages > .dt-card-head .tabs { margin-left: 8px; }
.dt-messages [data-dt-panel] > .msg-list { margin: 0; padding: 0 8px 6px; }
.dt-messages .chat-date-sep { margin: 4px 0; }
.dt-messages .is-clipped > .dt-clip { display: none; }
.dt-list-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 8px; padding: 10px 8px 6px; }
.dt-list-foot .link { border: 0; background: none; padding: 0; cursor: pointer; }
.dt-snapshot { display: flex; gap: 16px; align-items: flex-start; }
.dt-snapshot-image img { display: block; width: 96px; height: 96px; border-radius: var(--r-md); object-fit: cover; border: 1px solid var(--hairline); }
.dt-snapshot-fields { flex: 1 1 auto; min-width: 0; }
.dt-snapshot-fields .dt-kv > :last-child { font-weight: 400; overflow-wrap: anywhere; }
.dt-snapshot-analysis { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.dt-incidents .clickable-row { cursor: pointer; }
.dt-incident-text { color: var(--label-body); }
.dt-plat { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 10px; padding: 10px 0; border-top: 1px solid var(--hairline); }
.dt-card-head + .dt-plat { padding-top: 0; border-top: 0; }
.dt-plat-name { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; color: var(--label-1); }
.dt-plat-acts { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dt-plat-acts > .btn, .dt-plat-acts > .row-menu, .dt-plat-acts > .row-menu > .btn { width: 100%; justify-content: center; }
.dt-plat-acts > .dt-wide { grid-column: 1 / -1; color: var(--label-2); }
.dt-plat-acts .row-menu > .popover { min-width: 200px; }
.dt-switch-row { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--hairline); }
.dt-switch-row > label:first-child { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; margin: 0; cursor: pointer; }
.dt-switch-row b { color: var(--label-1); font-size: 13.5px; font-weight: 500; }
.dt-switch-row > label:first-child > span { font-size: 12px; color: var(--label-3); }
.dt-switch-row .toggle-switch { margin: 0; flex-shrink: 0; }
.dt-impact { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--fill-1); }
.dt-impact .big.pos { color: var(--green); }
.dt-impact .big.neg { color: var(--red); }
.dt-impact > span:last-child { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--label-2); }
.dt-impact b { color: var(--label-1); font-weight: 500; font-size: 13.5px; }
.dt-people { display: flex; flex-direction: column; }
.dt-person { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--hairline); color: inherit; text-decoration: none; font-size: 13.5px; }
.dt-person:first-child { border-top: 0; padding-top: 0; }
.dt-person b { min-width: 0; overflow: hidden; color: var(--label-1); font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.dt-person b .name-handle { font-weight: 400; color: var(--label-3); }
.dt-person:hover b { text-decoration: underline; }
.dt-person .when { margin-left: auto; flex-shrink: 0; font-size: 12px; }

@media (max-width: 1100px) {
    .dt-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) {
    .dt-kpis { --cols: 2 !important; }
}
@media (max-width: 600px) {
    .dt-id, .dt-handle { font-size: 16px; }
    .dt-author-line .user-dates { flex-basis: 100%; }
    .dt-snapshot { flex-direction: column; }
    .dt-chart { height: 170px; }
    /* A message's outcome tag wraps instead of running out of the row */
    .dt-page .badge.msg-outcome { flex-shrink: 1; max-width: 100%; height: auto; min-height: 20px; white-space: normal; }
    .dt-flush > .dt-card-head { padding: 12px 12px 8px; }
    .dt-flush > .msg-list { padding: 0 4px 4px; }
    .dt-facts { gap: 4px 12px; }
}

/* Decision buttons (action_button macro): an icon tile in the action's tone, the label and
   what it does, stacked full width. The tile and the border take the tone on hover. */
.dt-acts { display: flex; flex-direction: column; gap: 6px; }
.dt-act {
    --tone: var(--label-2); --tone-tint: var(--fill-2);
    display: flex; align-items: center; gap: 10px; width: 100%; margin: 0; padding: 8px 10px;
    border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--fill-1);
    color: var(--label-1); text-align: left; cursor: pointer;
    transition: border-color var(--dur-fast), background-color var(--dur-fast);
}
.dt-act.tone-good { --tone: var(--green); --tone-tint: var(--green-tint); }
.dt-act.tone-warn { --tone: var(--amber); --tone-tint: var(--amber-tint); }
.dt-act.tone-bad { --tone: var(--red); --tone-tint: var(--red-tint); }
.dt-act.tone-accent { --tone: var(--accent-text); --tone-tint: var(--accent-tint); }
.dt-act:hover { border-color: color-mix(in srgb, var(--tone) 45%, transparent); background: var(--tone-tint); }
.dt-act-ic { display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0; border-radius: var(--r-sm); background: var(--tone-tint); color: var(--tone); }
.dt-act-ic svg { width: 16px; height: 16px; }
.dt-act-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dt-act-text b { font-size: 13.5px; font-weight: 500; color: var(--label-1); }
.dt-act-text span { font-size: 12px; line-height: 1.35; color: var(--label-3); }
.dt-act.tone-bad .dt-act-text b { color: var(--red); }
