/* ==========================================================================
   Shared widgets: trees, lists, tool-window panels, balloons, splash, hints.
   ========================================================================== */

/* ------------------------------------------------------------------ splash */
#splash {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background: var(--bg-app);
  transition: opacity 300ms var(--ease);
}
#splash.gone { opacity: 0; pointer-events: none; }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 280px; }
.splash-logo svg { width: 56px; height: 56px; }
.splash-title { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; }
.splash-title span { color: var(--fg-muted); font-weight: 400; }
.splash-bar { width: 100%; height: 3px; border-radius: 2px; background: var(--bd-soft); overflow: hidden; }
.splash-bar > i { display: block; height: 100%; width: 5%; background: var(--accent); transition: width 220ms var(--ease); }
.splash-step { font-size: 11px; color: var(--fg-muted); }
.splash-error { max-width: 620px; padding: 20px; color: var(--fg); }
.splash-error pre { white-space: pre-wrap; font-family: var(--font-mono); font-size: 11px; color: var(--sq-error); }

/* ------------------------------------------------------------------- tree */
.tree { outline: none; position: relative; padding: 2px 0 8px; min-height: 100%; }
.tree-row {
  display: flex; align-items: center; gap: 4px;
  height: 22px; padding-right: 8px;
  white-space: nowrap; position: relative;
  transition: background 60ms var(--ease);
}
body.compact .tree-row { height: 19px; }
.tree-row:hover { background: var(--bg-hover); }
.tree-row.selected { background: var(--bg-sel); }
.tree:not(:focus) .tree-row.selected { background: var(--bg-sel-inactive); }
.tree-arrow {
  width: 13px; height: 13px; flex: none; display: grid; place-items: center;
  color: var(--fg-muted); border-radius: 2px;
}
.tree-arrow svg { width: 11px; height: 11px; }
.tree-arrow:hover { color: var(--fg); }
.tree-icon { width: 16px; height: 16px; flex: none; display: block; }
.tree-icon svg { width: 16px; height: 16px; display: block; }
/* The label keeps its width for as long as it can; the grey detail suffix is
   what gives way first, which is how JetBrains truncates these rows. */
.tree-label { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.tree-label b { color: var(--accent); font-weight: 600; }
.tree-row.selected .tree-label b { color: #9dc0ff; }
.tree-suffix {
  color: var(--fg-muted); font-size: 10.5px; margin-left: 6px;
  overflow: hidden; text-overflow: ellipsis;
  flex: 0 200 auto; min-width: 0;
}
.tree-badge { margin-left: auto; font-size: 10px; color: var(--fg-muted); }
.tree-row.speed-hit { box-shadow: inset 2px 0 0 var(--accent); }

/* project-tree state colours */
.tree-row.vcs-modified .tree-label { color: var(--vcs-modified); }
.tree-row.vcs-added .tree-label { color: var(--vcs-added); }
.tree-row.vcs-deleted .tree-label { color: var(--vcs-deleted); text-decoration: line-through; }
.tree-row.vcs-ignored .tree-label { color: var(--fg-disabled); }
.tree-row.vcs-untracked .tree-label { color: var(--vcs-conflict); }
.tree-row.dirty .tree-label::after { content: ' •'; color: var(--accent); }
.tree-row.has-error .tree-label { text-decoration: underline wavy var(--sq-error) 1px; text-underline-offset: 3px; }
.tree-row.has-warning .tree-label { text-decoration: underline wavy var(--sq-warning) 1px; text-underline-offset: 3px; }
.tree-row.mod-static .tree-label { font-style: italic; }
.tree-row.mod-private .tree-label { color: var(--fg-dim); }
.tree-row.sev-error .tree-label { color: var(--fg); }
.tree-row.sev-weak .tree-label, .tree-row.sev-unused .tree-label { color: var(--fg-dim); }
.tree-row.sev-error .tree-icon { color: var(--sq-error); }
.tree-row.sev-warning .tree-icon { color: var(--sq-warning); }
.tree-row.sev-weak .tree-icon, .tree-row.sev-unused .tree-icon,
.tree-row.sev-deprecated .tree-icon { color: var(--sq-weak); }
.tree-row.sev-typo .tree-icon { color: var(--sq-typo); }
.tree-row.sev-info .tree-icon { color: var(--sq-info); }
.tree-row.todo-fixme .tree-label { color: var(--sq-error); }
.tree-row.todo-hack .tree-label { color: var(--sq-warning); }
.tree-row.todo-note .tree-label { color: var(--sq-info); }

.speed-search {
  position: absolute; right: 8px; top: 4px; z-index: 5;
  background: var(--bg-popup); border: 1px solid var(--bd-strong);
  border-radius: var(--radius-s); padding: 2px 7px;
  box-shadow: var(--shadow-tooltip); display: flex; gap: 6px; align-items: baseline;
}
.speed-search .ss-label { font-weight: 600; }
.speed-search .ss-hint { font-size: 10px; color: var(--fg-muted); }
.speed-search.nomatch .ss-label { color: var(--sq-error); }

/* ------------------------------------------------------------------- list */
.list { outline: none; padding: 2px 0; }
.list-row {
  display: flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; white-space: nowrap;
}
.list-row:hover { background: var(--bg-hover); }
.list-row.selected { background: var(--bg-sel); }
.list:not(:focus) .list-row.selected { background: var(--bg-sel-inactive); }
.list-empty { padding: 14px; color: var(--fg-muted); text-align: center; }

/* ------------------------------------------------- tool-window specifics */
.prob-root, .todo-body, .prob-body, .struct-body, .notif-body { display: flex; flex-direction: column; min-height: 0; }
.prob-body, .todo-body, .struct-body { flex: 1; overflow: auto; }

.bm-icon { width: 15px; flex: none; color: var(--accent); }
.bm-icon svg { width: 14px; height: 14px; }
.bm-text { flex: 1; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
.bm-loc { color: var(--fg-muted); font-size: 10.5px; }

.notif-body { padding: 6px; gap: 6px; overflow: auto; }
.notif {
  border: 1px solid var(--bd-soft); border-left-width: 3px;
  border-radius: var(--radius-s); padding: 7px 9px; background: var(--bg-editor);
}
.notif.info { border-left-color: var(--accent); }
.notif.success { border-left-color: var(--run-green); }
.notif.warning { border-left-color: var(--sq-warning); }
.notif.error { border-left-color: var(--sq-error); }
.notif .n-head { display: flex; align-items: center; gap: 6px; }
.notif .n-icon svg { width: 14px; height: 14px; display: block; }
.notif.info .n-icon { color: var(--accent); }
.notif.success .n-icon { color: var(--run-green); }
.notif.warning .n-icon { color: var(--sq-warning); }
.notif.error .n-icon { color: var(--sq-error); }
.notif .n-title { font-weight: 600; flex: 1; }
.notif .n-time { color: var(--fg-muted); font-size: 10px; }
.notif .n-text { color: var(--fg-dim); margin-top: 3px; line-height: 1.5; }

/* --------------------------------------------------------------- balloons */
.balloons {
  position: fixed; right: 14px; bottom: 34px; z-index: var(--z-balloon);
  display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none;
  max-width: 380px;
}
.balloon {
  pointer-events: auto;
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--bg-popup); border: 1px solid var(--bd-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-m); padding: 10px 11px;
  box-shadow: var(--shadow-popup);
  transform: translateX(20px); opacity: 0;
  transition: transform 180ms var(--ease), opacity 180ms var(--ease);
}
.balloon.in { transform: none; opacity: 1; }
.balloon.leaving { opacity: 0; transform: translateX(20px); }
.balloon.success { border-left-color: var(--run-green); }
.balloon.warning { border-left-color: var(--sq-warning); }
.balloon.error { border-left-color: var(--sq-error); }
.balloon .b-icon svg { width: 15px; height: 15px; display: block; }
.balloon.info .b-icon { color: var(--accent); }
.balloon.success .b-icon { color: var(--run-green); }
.balloon.warning .b-icon { color: var(--sq-warning); }
.balloon.error .b-icon { color: var(--sq-error); }
.balloon .b-body { flex: 1; min-width: 0; }
.balloon .b-title { font-weight: 600; }
.balloon .b-text { color: var(--fg-dim); margin-top: 3px; line-height: 1.5; word-break: break-word; }
.balloon .b-actions { display: flex; gap: 12px; margin-top: 7px; }
.balloon .b-link { color: var(--accent); cursor: default; text-decoration: none; }
.balloon .b-link:hover { text-decoration: underline; }
.balloon .b-close { width: 16px; height: 16px; color: var(--fg-muted); flex: none; }
.balloon .b-close:hover { color: var(--fg); }
.balloon .b-close svg { width: 12px; height: 12px; }

/* ------------------------------------------------------------ editor hint */
.editor-hint {
  position: absolute; top: 40px; left: 50%; transform: translate(-50%, -8px);
  z-index: var(--z-float);
  background: var(--bg-popup); border: 1px solid var(--bd-strong);
  border-radius: var(--radius-m); padding: 5px 12px;
  box-shadow: var(--shadow-tooltip); font-family: var(--font-ui);
  opacity: 0; transition: opacity 130ms var(--ease), transform 130ms var(--ease);
  pointer-events: none; max-width: 70%; text-align: center;
}
.editor-hint.in { opacity: 1; transform: translate(-50%, 0); }
.editor-hint.error { border-color: var(--sq-error); color: var(--sq-error); }
.editor-hint.ok { border-color: var(--bd-strong); }

/* ---------------------------------------------------------- marker preview */
.marker-preview {
  position: fixed; z-index: var(--z-tooltip);
  background: var(--bg-popup); border: 1px solid var(--bd-strong);
  border-radius: var(--radius-s); box-shadow: var(--shadow-popup);
  padding: 4px 0; max-width: 520px; pointer-events: none;
  font-family: var(--font-mono); font-size: 11.5px; line-height: 17px;
}
.marker-preview .mp-msg {
  font-family: var(--font-ui); padding: 3px 10px 5px; color: var(--fg);
  border-bottom: 1px solid var(--bd-soft); margin-bottom: 3px;
  display: flex; gap: 6px; align-items: center; max-width: 460px;
}
.marker-preview .sev { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.marker-preview .sev.error { background: var(--sq-error); }
.marker-preview .sev.warning { background: var(--sq-warning); }
.marker-preview .sev.weak, .marker-preview .sev.unused { background: var(--sq-weak); }
.marker-preview .mp-row { display: flex; white-space: pre; padding: 0 8px; }
.marker-preview .mp-row.hit { background: var(--ed-caretrow); }
.marker-preview .mp-num { width: 34px; text-align: right; padding-right: 8px; color: var(--ed-linenum); flex: none; }
.marker-preview .mp-code { overflow: hidden; }

/* --------------------------------------------------------------- vcs hunk */
.vcs-hunk { min-width: 260px; }
.vh-bar { display: flex; gap: 2px; padding: 2px 4px; border-bottom: 1px solid var(--bd-soft); }
.vh-code { font-family: var(--font-mono); font-size: 11.5px; line-height: 17px; padding: 4px 8px; background: var(--vcs-deleted-bg); max-height: 220px; overflow: auto; }
.vh-row { white-space: pre; }
.vh-empty { padding: 8px 10px; color: var(--fg-muted); }

/* --------------------------------------------------------------- gutter bulb */
.bulb {
  position: absolute; left: 0; z-index: 7;
  width: 17px; height: var(--lh-editor);
  display: grid; place-items: center;
  color: var(--sq-warning); cursor: default;
}
.bulb svg { width: 14px; height: 14px; }
.bulb:hover { background: var(--bg-hover); border-radius: 2px; }
.bulb.has-fix { color: var(--sq-error); }

/* ------------------------------------------------------------- about box */
.about { text-align: center; padding: 8px 4px 4px; }
.about-logo svg { width: 48px; height: 48px; }
.about-name { font-size: 16px; font-weight: 600; margin-top: 8px; }
.about-ver { color: var(--fg-muted); font-size: 11px; margin-top: 2px; }
.about-body { margin-top: 14px; text-align: left; color: var(--fg-dim); line-height: 1.7; }
.about-row { margin-top: 4px; }
.about-row b { color: var(--fg); font-weight: 500; }

/* --------------------------------------------------------------- preview */
.prev-head {
  padding: 4px 10px; color: var(--fg-muted); font-family: var(--font-ui);
  border-bottom: 1px solid var(--bd-soft); font-size: 10.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prev-row { display: flex; white-space: pre; font-family: var(--font-mono); font-size: 11.5px; line-height: 17px; }
.prev-row.hit { background: var(--ed-caretrow); }
.prev-num { width: 38px; text-align: right; padding-right: 9px; color: var(--ed-linenum); flex: none; }
.prev-code { padding-right: 10px; }

/* ------------------------------------------------------- rename preview */
.rename-preview {
  margin-top: 10px; max-height: 190px; overflow: auto;
  border: 1px solid var(--bd-soft); border-radius: var(--radius-s);
  background: var(--bg-editor); font-family: var(--font-mono); font-size: 11.5px;
}
.rp-row { display: flex; white-space: pre; line-height: 18px; }
.rp-num { width: 40px; text-align: right; padding-right: 9px; color: var(--ed-linenum); flex: none; }
.rp-code b { background: var(--ed-search); color: var(--fg); font-weight: 400; }
.rp-more { padding: 4px 10px; color: var(--fg-muted); font-family: var(--font-ui); }

/* rename preview: grouped by file, hidden until the user asks for it */
.rename-preview.hidden { display: none; }
.rp-file {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 3px; font-family: var(--font-ui); font-size: 10.5px;
  color: var(--fg-dim); background: var(--bg-hover); position: sticky; top: 0;
}
.rp-count { margin-left: auto; color: var(--fg-muted); }
