/* Round 3 · A: reasons for changes (why bar, voice notes), where a number came from, scenarios. */

/* ---------- why bar ---------- */
.why-bar { position: fixed; bottom: 20px; transform: translate(-50%, 12px); width: min(880px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 16px 40px rgba(16,24,20,.16); z-index: 60; opacity: 0; transition: opacity .18s, transform .18s; display: flex; flex-direction: column; }
.why-bar.on { opacity: 1; transform: translate(-50%, 0); }
.wb-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px 8px 16px; min-width: 0; }
.wb-head b { font-weight: 600; min-width: 0; }
.wb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-2); flex: none; }
.wb-dot.rev { background: var(--accent); }
.wb-row { display: flex; gap: 8px; padding: 0 16px; }
.wb-row .input { flex: 1; height: 36px; }
.wb-sug { display: flex; align-items: center; gap: 6px; padding: 10px 16px 12px; flex-wrap: wrap; min-height: 22px; }
.wb-req { color: #8A5A0E; }
.why-bar .vz-panel { margin: 8px 16px 0; }
.sug-chip { height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--line-2); background: var(--surface); font: inherit; font-size: 12px; color: var(--ink-2); cursor: pointer; transition: background .15s, border-color .15s; }
.sug-chip:hover { border-color: #B9D5C3; background: var(--brand-tint); color: var(--ink); }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* ---------- voice ---------- */
.mic-btn { width: 36px; height: 36px; flex: none; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); color: var(--brand-2); display: grid; place-items: center; cursor: pointer; transition: background .15s, border-color .15s; }
.mic-btn:hover { background: var(--brand-tint); border-color: #B9D5C3; }
.mic-btn.on { color: #fff; background: var(--red); border-color: var(--red); animation: micpulse 1.4s infinite; }
@keyframes micpulse { 50% { box-shadow: 0 0 0 5px rgba(194,59,46,.15); } }
.vz-panel { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.vz-live { display: flex; align-items: center; gap: 10px; }
.vz-rec { width: 10px; height: 10px; border-radius: 50%; background: var(--red); flex: none; animation: vzblink 1.2s infinite; }
@keyframes vzblink { 50% { opacity: .3; } }
.vz-wave { display: flex; align-items: center; gap: 3px; height: 28px; }
.vz-wave span { width: 3px; border-radius: 2px; background: var(--brand-2); transition: height .08s; }
.vz-said { color: var(--muted); line-height: 1.5; }
.vz-said b { color: var(--ink-2); font-weight: 600; }
.vz-note { border: 1.5px solid #B9D5C3; background: #F5FAF7; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; line-height: 1.5; }
@media (prefers-reduced-motion: reduce) { .mic-btn.on, .vz-rec { animation: none; } .why-bar { transition: opacity .18s; } }

/* reason field in dialogs */
.rsn-box { position: relative; }
.rsn-box .textarea { width: 100%; padding-right: 52px; min-height: 84px; }
.rsn-box .mic-btn { position: absolute; right: 8px; top: 8px; width: 34px; height: 34px; }

/* ---------- where a number came from ---------- */
.trail-pop { position: fixed; width: 360px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 16px 40px rgba(16,24,20,.16); z-index: 70; font-size: 13px; line-height: 1.45; text-align: left; animation: tpin .14s ease-out; }
@keyframes tpin { from { opacity: 0; transform: translateY(-3px); } }
.trail-pop::before { content: ''; position: absolute; left: calc(var(--ax, 50%) - 6px); top: -7px; width: 12px; height: 12px; background: var(--surface); border-left: 1px solid var(--line-2); border-top: 1px solid var(--line-2); transform: rotate(45deg); }
.trail-pop.up::before { top: auto; bottom: -7px; transform: rotate(225deg); }
.tp-head { padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 3px; }
.tp-v { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
.tp-item { display: flex; gap: 10px; padding: 9px 14px; border-top: 1px solid #EFEEE9; }
.tp-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--brand-2); background: var(--surface); margin-top: 5px; flex: none; }
.tp-item.actual .tp-dot { border-color: #A9ADB1; }
.tp-item.support .tp-dot { background: var(--brand-2); }
.tp-item.origin .tp-dot { border-color: #C9C8C2; border-style: dashed; }
.tp-reason { margin-top: 4px; color: var(--ink-2); font-size: 12.5px; }
.cite-chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; margin-top: 5px; padding: 0 7px; border: 0; border-radius: 6px; background: #EEF0F2; color: #3D4349; font: inherit; font-size: 11.5px; font-weight: 500; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cite-chip:hover { background: #E2E5E8; }
.tp-foot { display: flex; gap: 8px; padding: 10px 14px 12px; border-top: 1px solid #EFEEE9; }

/* ---------- scenarios ---------- */
.scn-cur { display: flex; align-items: center; gap: 28px; padding: 12px 20px; flex-wrap: wrap; }
.imp { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; flex: none; }
.imp.neg { background: var(--red-tint, #FBEDEA); color: #A8301F; }
.imp.pos { background: var(--brand-tint); color: var(--brand-2); }
.imp.neu { background: var(--sunken); color: var(--muted); font-weight: 500; }
.scn-row { cursor: pointer; }
.scn-row.picked { background: var(--brand-tint); }
.scn-name { font-weight: 500; }
.scn-ck { width: 18px; flex: none; display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.scn-ck input { accent-color: var(--brand); width: 15px; height: 15px; margin: 0; }
.scn-row:hover .scn-ck, .scn-row.picked .scn-ck, .scn-ck:focus-within { opacity: 1; }
.scn-ask { display: flex; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid #EFEEE9; }
.scn-ask .input { flex: 1; }
.scn-detail { display: flex; gap: 16px; align-items: flex-start; }
.scn-crumb .scn-title { font-size: 16px; font-weight: 600; letter-spacing: -0.3px; padding: 2px 4px; border-radius: 6px; cursor: text; outline: none; }
.scn-crumb .scn-title:hover, .scn-crumb .scn-title[contenteditable="true"] { background: var(--sunken); }
.scn-ks { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.scn-k { display: flex; flex-direction: column; gap: 3px; padding: 14px 18px; border-left: 1px solid #EFEEE9; }
.scn-k:first-child { border-left: 0; }
.scn-big { font-size: 22px; font-weight: 600; letter-spacing: -0.4px; }
.scn-big.neg, .scn-tbl .neg, .scn-cmp .neg { color: #A8301F; }
.scn-tbl .pos, .scn-cmp .pos { color: var(--brand-2); }
.scn-val { width: 110px; height: 30px; text-align: right; }
.scn-detail .select.sm { height: 30px; font-size: 12.5px; }
.scn-off { color: var(--muted); }
.scn-addrow { flex-wrap: wrap; background: var(--surface-2); }
.scn-addrow .select { max-width: 220px; }
.scn-tbl { margin: 0; }
.scn-tbl tr.tot td { font-weight: 600; }
.scn-chat { width: 340px; flex: none; display: flex; flex-direction: column; max-height: calc(100vh - 140px); position: sticky; top: 0; }
.scn-msgs { flex: 1; overflow-y: auto; padding: 4px 16px 10px; display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.scn-msgs .msg-u { align-self: flex-end; background: var(--sunken); padding: 8px 12px; border-radius: 14px 14px 4px 14px; max-width: 88%; font-size: 13px; }
.scn-msgs .msg-a { font-size: 13px; line-height: 1.55; color: var(--ink); }
.scn-sugs { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 8px; }
.scn-say { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid #EFEEE9; }
.scn-say .input { flex: 1; height: 34px; }
.scn-cmp th, .scn-cmp td { padding: 10px 14px; }
@media (max-width: 1100px) { .scn-detail { flex-direction: column; } .scn-chat { width: 100%; position: static; max-height: none; } }
.vz-panel[hidden] { display: none; }
.scn-detail .rl-row .select, .scn-detail .rl-row .input { width: auto; flex: none; }
.scn-detail .rl-row .scn-name { flex: 1; min-width: 0; }
.scn-detail .rl-row .pill { flex: none; white-space: nowrap; }
.scn-detail .rl-row .scn-val { width: 96px; }
.modal .table td.num, .modal .table td.r { white-space: nowrap; }
.mic-btn[hidden] { display: none; }
