* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f1117;
    color: #e4e4e7;
    line-height: 1.6;
    overflow: hidden;
}

/* ── App shell ── */
.app-shell { display: flex; height: 100vh; min-height: 0; }
.app-sidebar {
    width: 300px;
    flex-shrink: 0;
    border-right: 1px solid #2a2d3a;
    background: #161922;
    overflow-y: auto;
    padding: 18px 14px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.app-sidebar header h1 { font-size: 1.2rem; margin: 0 0 4px; }
.app-sidebar header .subtitle { font-size: 0.78rem; color: #a1a1aa; line-height: 1.4; }

.controls { display: flex; flex-direction: column; gap: 14px; }
.sidebar-label {
    text-transform: uppercase; letter-spacing: 0.06em;
    font-size: 0.68rem; color: #71717a; font-weight: 600; margin-bottom: 5px;
}
.search-box, .filters { display: flex; flex-direction: column; gap: 6px; }
input[type="text"], select {
    width: 100%;
    background: #0f1117; border: 1px solid #2a2d3a; color: #e4e4e7;
    padding: 7px 9px; border-radius: 6px; font-size: 0.85rem; font-family: inherit;
}
input[type="text"]:focus, select:focus { outline: none; border-color: #2dd4bf; }
select { cursor: pointer; }
button {
    background: #262a38; border: 1px solid #2a2d3a; color: #e4e4e7;
    padding: 7px 10px; border-radius: 6px; font-size: 0.82rem; cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
button:hover { background: #313649; border-color: #4b5266; }
.nav-controls { display: flex; gap: 6px; align-items: center; }
.nav-controls button { flex: 1; }
.nav-controls #counter {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem; color: #a1a1aa; text-align: center; min-width: 64px;
}
.sidebar-footer {
    margin-top: auto; display: flex; flex-direction: column; gap: 4px;
    font-size: 0.76rem; border-top: 1px solid #2a2d3a; padding-top: 12px;
}
.sidebar-footer a { color: #2dd4bf; text-decoration: none; }
.sidebar-footer a:hover { text-decoration: underline; }

/* ── Main ── */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-main-body { flex: 1; overflow-y: auto; }
.container { max-width: 980px; margin: 0 auto; padding: 28px 32px 64px; }
#loading { color: #a1a1aa; padding: 40px 0; text-align: center; }

.card { background: #161922; border: 1px solid #2a2d3a; border-radius: 12px; padding: 24px 26px; }
.card-header { border-bottom: 1px solid #2a2d3a; padding-bottom: 16px; margin-bottom: 6px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.badge {
    font-size: 0.72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
    border: 1px solid transparent; letter-spacing: 0.01em;
}
.badge.target { background: #10312e; color: #5eead4; border-color: #1f5b54; }
.badge.kw     { background: #2a1e3a; color: #d8b4fe; border-color: #55326b; }
.badge.cond   { background: #262a38; color: #cbd5e1; border-color: #3b4256; }
.badge.support{ background: #1e2a3a; color: #7dd3fc; border-color: #2f4f6b; }
.badge.across { background: #3a2f1e; color: #fbbf24; border-color: #6b562f; }
#questionText { font-size: 1.3rem; line-height: 1.45; font-weight: 650; color: #f4f4f5; }

.condition-bar {
    margin-top: 12px; font-size: 0.85rem; color: #cbd5e1;
    background: #12141c; border: 1px solid #23262f; border-radius: 8px; padding: 10px 14px;
}
.condition-bar .cond-label { color: #71717a; text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.06em; margin-right: 6px; }
.cond-chip {
    display: inline-block; background: #1e2130; border: 1px solid #2f3444; border-radius: 6px;
    padding: 2px 8px; margin: 2px 4px 2px 0; font-size: 0.82rem;
}
.cond-chip .ct { color: #5eead4; font-weight: 600; }
.cond-chip .cv { color: #e4e4e7; }

/* ── Sections ── */
.section { border-top: 1px solid #23262f; }
.section:first-of-type { border-top: none; }
.section-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.98rem; font-weight: 600; color: #e4e4e7;
    padding: 15px 0 12px; cursor: pointer; user-select: none;
}
.section-title:hover { color: #fff; }
.section-title .toggle-icon { font-size: 0.7rem; color: #2dd4bf; width: 12px; }
.section-title .count { font-size: 0.78rem; color: #71717a; font-weight: 500; }
.section-content { padding-bottom: 16px; }

/* ── Answer / options bars ── */
#answerBanner {
    background: #10312e; border: 1px solid #1f5b54; border-left: 3px solid #2dd4bf;
    border-radius: 8px; padding: 12px 16px; margin-bottom: 14px;
}
#answerBanner .ab-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: #5eead4; }
#answerBanner .ab-text { font-size: 1.05rem; font-weight: 650; color: #f4f4f5; margin-top: 2px; }
#answerBanner .ab-weight { font-size: 0.8rem; color: #a1a1aa; }

.bar-row { display: flex; align-items: center; gap: 10px; margin: 5px 0; }
.bar-label { flex: 0 0 46%; font-size: 0.85rem; color: #d4d4d8; word-break: break-word; }
.bar-track { flex: 1; background: #12141c; border-radius: 5px; height: 20px; position: relative; overflow: hidden; border: 1px solid #23262f; }
.bar-fill { height: 100%; background: #14b8a6; border-radius: 5px 0 0 5px; }
.bar-row.top .bar-fill { background: #2dd4bf; }
.bar-row.top .bar-label { color: #f4f4f5; font-weight: 650; }
.bar-val { flex: 0 0 66px; text-align: right; font-family: ui-monospace, monospace; font-size: 0.78rem; color: #a1a1aa; }
.evidence-fill { background: #7dd3fc; }

/* ── Supporting conversations ── */
.support-note { font-size: 0.8rem; color: #a1a1aa; margin-bottom: 10px; }
.support-note .warn { color: #fbbf24; }
#supportList { display: flex; flex-direction: column; gap: 8px; }
.conv-card { border: 1px solid #2a2d3a; border-radius: 8px; background: #12141c; overflow: hidden; }
.conv-head { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; cursor: pointer; user-select: none; }
.conv-head:hover { background: #171a24; }
.conv-ord { font-family: ui-monospace, monospace; font-size: 0.72rem; font-weight: 700; color: #7dd3fc; background: #1e2130; border-radius: 5px; padding: 2px 7px; flex-shrink: 0; margin-top: 1px; }
.conv-head-main { flex: 1; min-width: 0; }
.conv-summary { font-size: 0.88rem; color: #e4e4e7; }
.conv-sub { font-size: 0.74rem; color: #71717a; margin-top: 3px; }
.conv-sub .chip { color: #94a3b8; }
.conv-toggle { font-size: 0.7rem; color: #2dd4bf; flex-shrink: 0; margin-top: 3px; }
.conv-body { border-top: 1px solid #23262f; padding: 12px 14px; display: none; max-height: 560px; overflow-y: auto; }
.conv-body.open { display: block; }
.conv-loading { color: #71717a; font-size: 0.82rem; }
.conv-meta-line { font-size: 0.74rem; color: #71717a; margin-bottom: 10px; word-break: break-word; }

.turn { margin: 8px 0; padding: 9px 12px; border-radius: 8px; font-size: 0.85rem; }
.turn.user { background: #16202b; border: 1px solid #24384a; }
.turn.assistant { background: #1a1626; border: 1px solid #33294a; }
.turn-role { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; margin-bottom: 4px; }
.turn.user .turn-role { color: #7dd3fc; }
.turn.assistant .turn-role { color: #c4b5fd; }
.turn-content { white-space: pre-wrap; word-wrap: break-word; color: #d4d4d8; font-size: 0.84rem; }

/* ── Meta ── */
#metaBody { font-size: 0.84rem; }
.meta-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin-bottom: 12px; }
.meta-k { color: #71717a; }
.meta-v { color: #d4d4d8; word-break: break-word; font-family: ui-monospace, monospace; font-size: 0.8rem; }
.probe-box { background: #12141c; border: 1px solid #23262f; border-radius: 8px; padding: 12px 14px; margin-top: 8px; }
.probe-box .pb-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: #71717a; margin-bottom: 4px; }
.probe-box .pb-explain { color: #cbd5e1; margin-bottom: 8px; font-size: 0.85rem; }
.probe-box ul { margin: 0 0 0 20px; }
.probe-box li { color: #d4d4d8; font-size: 0.82rem; margin: 2px 0; }
