/* Session Replay Viewer — issues: unified issue list rows, issue / native crash detail layout (two
   columns, details card), stack frame list, distribution tables. Reads the --kt-* tokens from app.css. */


.kt-details dd small { display: block; font-size: 12px; font-weight: 400; color: var(--kt-muted); }
.kt-card-note { font-size: 12.5px; font-weight: 400; color: var(--kt-muted); margin-left: 6px; }
.iss-by { margin-top: 4px; font-size: 12px; font-weight: 400; color: var(--kt-muted); }
.iss-by b { color: var(--kt-ink); font-weight: 600; }

/* ── list filters: segmented status (with counts) and source, then search / selects ───────────────── */
.iss-filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.iss-filters-gap { flex: 1 1 100%; height: 0; margin: -6px 0; }
.iss-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 22px; background: var(--kt-tonal); }
.iss-seg button {
    border: 0; border-radius: 999px; padding: 6px 16px; min-height: 32px; background: transparent; color: var(--kt-muted);
    font: 500 13px/20px "Poppins", sans-serif; cursor: pointer; white-space: nowrap;
}
.iss-seg button:hover { color: var(--kt-ink); }
.iss-seg button.on { background: var(--kt-surface); color: var(--kt-ink); font-weight: 600; box-shadow: var(--kt-card-shadow); }
.iss-search { flex: 1 1 280px; max-width: 420px; margin: 0 !important; }
.iss-select { flex: 0 1 200px; margin: 0 !important; }
.iss-select.narrow { flex-basis: 150px; }

/* ── list rows (KidsTime ListRow): icon tile, title + message on one line, culprit below in grey mono,
      counts as a meta line, status tags in the top-right corner, a quiet chevron ───────────────────── */
.iss-list { display: flex; flex-direction: column; gap: 8px; }
.iss-row {
    position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; min-width: 0; cursor: pointer;
    background: var(--kt-surface); border: 1px solid var(--kt-border); border-radius: var(--kt-radius-md); box-shadow: var(--kt-card-shadow);
    transition: background-color .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.iss-row:hover { background: var(--kt-surface-hover); border-color: var(--kt-border-strong); box-shadow: var(--kt-shadow-hover); }
.iss-ico { width: 40px; height: 40px; flex: none; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; background: var(--kt-red-bg); color: var(--kt-red-text); }
.iss-ico.handled { background: var(--kt-yellow-bg); color: var(--kt-yellow-ink); }
.iss-ico.native { background: var(--kt-purple-bg); color: var(--kt-purple-ink); }
.iss-main { flex: 1 1 auto; min-width: 0; }
.iss-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.iss-type { font-size: 16px; font-weight: 600; color: var(--kt-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; max-width: 100%; }
.iss-msg { font-size: 14px; color: var(--kt-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 0; min-width: 0; }
.iss-culprit { margin-top: 2px; font-family: var(--kt-mono); font-size: 12px; color: var(--kt-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iss-meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 12.5px; color: var(--kt-muted); }
.iss-meta b { color: var(--kt-ink); font-weight: 600; }
.iss-tags { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; flex: 0 0 auto; max-width: 45%; }
.kt-title .iss-tags { max-width: none; justify-content: flex-start; order: 0 !important; flex: 0 1 auto !important; }
.iss-go { align-self: center; flex: none; color: var(--kt-icon-muted); font-size: 12px; }
.iss-row:hover .iss-go { color: var(--kt-ink); }
.iss-lead { font-size: 15px; color: var(--kt-muted); overflow-wrap: anywhere; }

/* ── detail: wide column + narrow Details card ────────────────────────────────────────────────────── */
.iss-detail { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 26%, 400px); gap: 24px; align-items: start; }
.iss-detail-main, .iss-detail-side { min-width: 0; }
/* Two masonry columns: cards of different heights stack without holes. */
.iss-dist-grid { columns: 2; column-gap: 16px; }
.iss-dist { padding: 16px; break-inside: avoid; margin-bottom: 16px; }
.iss-dist-grid.mb-4 { margin-bottom: 8px !important; }
.iss-dist-table { width: 100%; border-collapse: collapse; }
.iss-dist-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--kt-muted); padding: 8px 10px; background: var(--kt-bg); white-space: nowrap; }
.iss-dist-table th:first-child { border-radius: 8px 0 0 8px; }
.iss-dist-table th:last-child { border-radius: 0 8px 8px 0; }
.iss-dist-table th small, .iss-dist-table td small { display: block; font-size: 11px; font-weight: 400; color: var(--kt-muted); }
.iss-dist-table td { padding: 9px 10px; border-bottom: 1px solid var(--kt-border); vertical-align: middle; font-size: 13.5px; }
.iss-dist-table tr:last-child td { border-bottom: 0; }
.iss-dist-table .num { text-align: right; white-space: nowrap; width: 1%; font-variant-numeric: tabular-nums; }
.iss-dist-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; color: var(--kt-ink); }
.iss-dist-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.iss-dist-name .mono { font-weight: 500; font-size: 12.5px; }
.iss-dist-ico { width: 24px; height: 24px; flex: none; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; background: var(--kt-tonal); color: var(--kt-ink); }
.iss-bar { margin-top: 6px; height: 4px; border-radius: 999px; background: var(--kt-tonal); overflow: hidden; }
.iss-bar > span { display: block; height: 100%; min-width: 4px; border-radius: 999px; background: var(--viz-s1, #2a78d6); }
html[data-theme="dark"] .iss-bar > span { background: #3987e5; }
.iss-trend-range { margin-top: 2px; font-size: 12px; color: var(--kt-muted); }

/* Occurrences inside a card: plain rows with hairlines (not row-cards within a card). */
.mud-table.kt-plain.iss-occ { background: transparent; box-shadow: none; border: 0; }
.mud-table.kt-plain.iss-occ .mud-table-head .mud-table-cell { background: var(--kt-bg); border: 0; font-size: 12px; font-weight: 600; color: var(--kt-muted); padding: 8px 12px; }
.mud-table.kt-plain.iss-occ .mud-table-head .mud-table-cell:first-child { border-radius: 8px 0 0 8px; }
.mud-table.kt-plain.iss-occ .mud-table-head .mud-table-cell:last-child { border-radius: 0 8px 8px 0; }
.mud-table.kt-plain.iss-occ .mud-table-body .mud-table-cell { border-bottom: 1px solid var(--kt-border); padding: 8px 12px; font-size: 13.5px; font-weight: 500; background: transparent; }
.mud-table.kt-plain.iss-occ .mud-table-body .mud-table-row:last-child .mud-table-cell { border-bottom: 0; }
.mud-table.kt-plain.iss-occ .mud-table-body .mud-table-row:hover .mud-table-cell { background: var(--kt-surface-hover); }
.mud-table.kt-plain.iss-occ .mud-table-body .mud-table-row.native-row-active .mud-table-cell { background: var(--kt-blue-bg); }

/* ── stack: a list of frames, not a terminal block ───────────────────────────────────────────────── */
.stk-bar, .iss-stack-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.stk-spacer { flex: 1 1 0; }
.stk-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--kt-border); border-radius: var(--kt-radius-md); overflow: hidden; }
.stk-list > li { border-top: 1px solid var(--kt-border); }
.stk-list > li:first-child { border-top: 0; }
.stk-frame { padding: 8px 14px; border-left: 3px solid transparent; min-width: 0; }
.stk-frame.own { background: var(--kt-yellow-bg); border-left-color: var(--kt-yellow); }
.stk-frame.fw { background: var(--kt-bg); }
.stk-method { font-family: var(--kt-mono); font-size: 12.5px; font-weight: 600; color: var(--kt-ink); overflow-wrap: anywhere; }
.stk-frame.fw .stk-method { font-weight: 500; color: var(--kt-muted); }
.stk-ns { font-weight: 400; color: var(--kt-muted); }
.stk-loc { margin-top: 1px; font-family: var(--kt-mono); font-size: 12px; color: var(--kt-muted); overflow-wrap: anywhere; }
.stk-frame.own .stk-loc { color: var(--kt-yellow-ink); }
.stk-note { padding: 8px 14px; font-size: 12.5px; color: var(--kt-ink); overflow-wrap: anywhere; background: var(--kt-surface); }
.stk-fold > button {
    width: 100%; min-height: 36px; padding: 6px 14px; border: 0; background: var(--kt-surface); color: var(--kt-muted); text-align: left; cursor: pointer;
    display: flex; align-items: center; justify-content: flex-start; gap: 8px; font: 500 12.5px "Poppins", sans-serif;
}
.stk-fold > button:hover { background: var(--kt-surface-hover); color: var(--kt-ink); }
.stk-fold > button i { font-size: 10px; width: 12px; }
.stk-raw { margin: 0; padding: 12px 14px; border: 1px solid var(--kt-border); border-radius: var(--kt-radius-md); background: var(--kt-bg); color: var(--kt-ink);
    font-family: var(--kt-mono); font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 480px; overflow: auto; }
.stk-empty { padding: 16px; border: 1px dashed var(--kt-border-strong); border-radius: var(--kt-radius-md); color: var(--kt-muted); font-size: 13.5px; text-align: center; }

/* Native stack: threads and frames in the same convention (method bold, binary / location grey, own code
   highlighted, system frames quiet, the folded system run is a row-button). */
.native-thread { border-radius: var(--kt-radius-md); margin-top: 0; margin-bottom: 10px; }
.native-thread-head { font-size: 12.5px; padding: 8px 14px; }
.native-frame { padding: 7px 14px; font-size: 12.5px; }
.native-frame .fn { font-weight: 600; color: var(--kt-ink); overflow-wrap: anywhere; word-break: normal; }
.native-frame.system { opacity: 1; background: var(--kt-bg); }
.native-frame.system .fn, .native-frame.system .bin { font-weight: 400; color: var(--kt-muted); }
.native-frame.inapp .fn { font-weight: 500; }
.native-frame .off { font-weight: 400; }
.native-frame.native-fold { font-style: normal; cursor: pointer; background: var(--kt-surface); min-height: 36px; align-items: center; }
.native-frame.native-fold:hover { opacity: 1; background: var(--kt-surface-hover); }
.native-frame.native-fold:focus-visible { outline: 2px solid var(--kt-focus); outline-offset: -2px; }
.native-missing, .native-symver { margin: 0 0 12px; }

/* ── responsive ──────────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 1099.98px) {
    .iss-detail { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .iss-detail-side { order: -1; }
}
@media (max-width: 767.98px) {
    .iss-filters { gap: 8px; }
    .iss-filters-gap { display: none; }
    .iss-seg { max-width: 100%; }
    .iss-seg button { padding: 6px 12px; }
    .iss-search, .iss-select, .iss-select.narrow { flex: 1 1 100%; max-width: none; }
    .iss-row { flex-wrap: wrap; padding: 12px; }
    .iss-ico { width: 36px; height: 36px; }
    .iss-main { flex: 1 1 0; }
    .iss-title { flex-direction: column; gap: 0; }
    .iss-type, .iss-msg { white-space: normal; overflow: visible; max-width: 100%; flex: none; overflow-wrap: anywhere; }
    .iss-msg { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .iss-tags { order: -1; flex: 1 1 100%; max-width: none; justify-content: flex-start; }
    .iss-go { display: none; }
    .iss-dist-grid { columns: 1; }
}

/* MudSelect wraps the field in its own flex item: keep the selects at their width, left-aligned after the search. */
.iss-filters > .mud-select { flex: 0 0 200px; margin: 0; }
.iss-filters > .mud-select:last-child { flex-basis: 150px; }
@media (max-width: 767.98px) { .iss-filters > .mud-select, .iss-filters > .mud-select:last-child { flex: 1 1 140px; } }

/* Note above a native stack: the device had to cut an oversized report. */
.stk-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; padding: 8px 12px; border-radius: var(--kt-radius-md); background: var(--kt-yellow-bg); color: var(--kt-yellow-ink); font-size: 13px; }

/* Narrower screens (two-column issue page): file:line goes under the function name instead of squeezing it into a
   few characters per line — a long "File.cs:123 · method" in its own nowrap column left the name almost no width. */
@media (min-width: 640.02px) and (max-width: 1599.98px) {
    .native-frame .loc { grid-column: 3 / -1; justify-self: start; }
}

/* Wide screens: the stack takes the room — a wider binary column, function names on one line, aligned offsets. */
@media (min-width: 1600px) {
    .native-frame { grid-template-columns: 2.6rem minmax(10rem, 15rem) minmax(0, 1fr) auto; }
    .native-frame .off, .native-frame .loc { font-variant-numeric: tabular-nums; text-align: right; }
}

/* Function offset (machine-code bytes, hex) is a quiet aside; file:line, when known, is the main location. */
.native-frame .off { margin-left: 8px; font-size: 11px; font-weight: 400; color: var(--kt-muted); cursor: help; }
.native-frame .loc { font-weight: 600; color: var(--kt-ink); }
.native-frame.system .loc { font-weight: 400; color: var(--kt-muted); }
.native-frame .loc .loc-note { font-weight: 400; color: var(--kt-muted); }

/* ── error context: "Called from" facts and the breadcrumb trail ("What happened before the error") ─────── */
.ectx-hint { margin: -4px 0 10px; font-size: 13px; color: var(--kt-muted); }
.ectx-facts { margin-top: 12px; }
.ectx-trail { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ectx-step { position: relative; display: grid; grid-template-columns: 56px 28px minmax(0, 1fr); gap: 10px; align-items: start; padding: 6px 0; }
.ectx-step + .ectx-step::before { content: ""; position: absolute; left: 79px; top: -6px; height: 12px; border-left: 2px solid var(--kt-border); }
.ectx-time { font-family: var(--kt-mono); font-size: 12px; color: var(--kt-muted); text-align: right; padding-top: 5px; white-space: nowrap; }
.ectx-ico { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; background: var(--kt-grey-bg); color: var(--kt-grey-ink); }
.ectx-step.warning .ectx-ico { background: var(--kt-yellow-bg); color: var(--kt-yellow-ink); }
.ectx-step.error .ectx-ico { background: var(--kt-red-bg); color: var(--kt-red-text); }
.ectx-body { display: flex; flex-direction: column; min-width: 0; padding-top: 3px; }
.ectx-cat { font-size: 12px; font-weight: 600; color: var(--kt-muted); }
.ectx-msg { font-size: 13.5px; color: var(--kt-ink); overflow-wrap: anywhere; }
.ectx-msg-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.ectx-msg-full { font-family: var(--kt-mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow-y: auto;
    padding: 8px 10px; margin: 2px 0; border-radius: 8px; background: var(--kt-grey-bg); }
.ectx-more { align-self: flex-start; padding: 0; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 600;
    color: var(--kt-muted); text-decoration: underline; cursor: pointer; }
.ectx-more:hover { color: var(--kt-ink); }
.ectx-data { font-family: var(--kt-mono); font-size: 11.5px; color: var(--kt-muted); overflow-wrap: anywhere; }
.ectx-now .ectx-cat { color: var(--kt-red-text); }
@media (max-width: 600px) {
    .ectx-step { grid-template-columns: 44px 24px minmax(0, 1fr); gap: 8px; }
    .ectx-step + .ectx-step::before { left: 63px; }
    .ectx-ico { width: 24px; height: 24px; }
}

/* Server errors (ASP.NET Core SDK) linked to a client session: the badge on the request row, the highlighted request. */
.srv-err-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 1px 8px; border-radius: 999px;
    font-family: inherit; font-size: 11px; font-weight: 600; white-space: nowrap; text-decoration: none;
    color: var(--kt-red-text); background: var(--kt-red-bg); }
.srv-err-badge:hover { text-decoration: underline; }
tr.srv-err-hl > td { background: var(--kt-yellow-bg); }

/* ── probable cause: the earlier error an occurrence followed (GET api/exceptions/{id}/cause) ─────────────── */
.iss-cause {
    display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; padding: 12px 16px;
    border-radius: var(--kt-radius-md); border: 1px solid var(--kt-border); background: var(--kt-tonal); color: var(--kt-ink);
}
.iss-cause.probable { background: var(--kt-yellow-bg); border-color: var(--kt-yellow); }
.iss-cause-ico { margin-top: 3px; flex: none; color: var(--kt-muted); }
.iss-cause.probable .iss-cause-ico { color: var(--kt-yellow-ink); }
.iss-cause-body { flex: 1 1 auto; min-width: 0; }
.iss-cause-lead { font-size: 14px; font-weight: 600; }
.iss-cause-when { font-weight: 400; color: var(--kt-muted); }
.iss-cause-what { margin-top: 2px; font-size: 13.5px; overflow-wrap: anywhere; }
.iss-cause-where { margin-top: 2px; font-family: var(--kt-mono); font-size: 12px; color: var(--kt-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iss-cause-open { flex: none; align-self: center; }
@media (max-width: 600px) {
    .iss-cause { flex-wrap: wrap; }
    .iss-cause-ico { display: none; }
}
