/* ============================================================
   PhpStorm-like Web IDE — application styles
   JetBrains New UI inspired chrome, dark + light themes
   ============================================================ */

/* ---------- theme variables ---------- */
:root, body[data-theme="dark"] {
  --ui-font: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --mono-font: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --bg: #1E1F22;              /* editor background */
  --bg-panel: #2B2D30;        /* tool windows, panels */
  --bg-toolbar: #2B2D30;
  --bg-title: #2B2D30;
  --bg-elevated: #33353A;     /* popups, menus */
  --bg-field: #1E1F22;
  --bg-hover: #3C3F44;
  --bg-pressed: #43454A;
  --bg-stripe-hover: #33353A;
  --bg-tab-active: #1E1F22;
  --bg-inset: #26282B;

  --fg: #DFDFE3;              /* UI text */
  --fg-editor: #BCBEC4;       /* editor default */
  --fg-dim: #9DA0A8;
  --fg-faint: #73767D;
  --fg-line-num: #67707B;

  --border: #393B40;
  --border-strong: #4C4F56;
  --accent: #3574F0;
  --accent-hover: #4C7DF0;
  --accent-dim: #2E4C79;
  --selection: #2E4C79;
  --selection-layer: rgba(58, 94, 160, 0.55);

  --error: #F75464;  --error-bg: rgba(247, 84, 100, .16);
  --warn: #F0A72C;   --warn-bg: rgba(240, 167, 44, .16);
  --weak: #9A9A9E;   --weak-bg: rgba(140, 140, 150, .18);
  --info-blue: #4F9DF7;
  --add-green: #5FB865;
  --mod-blue: #57AAF7;
  --vcs-green: #499C54;
  --vcs-blue: #6188B8;

  --shadow-popup: 0 8px 24px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.4);
  --shadow-dialog: 0 16px 48px rgba(0,0,0,.6);

  /* editor syntax */
  --s-kw: #CF8E6D; --s-str: #6AAB73; --s-num: #2AACB8; --s-com: #7A7E82;
  --s-fn: #56A8F5; --s-cls: #B18926; --s-const: #9876AA; --s-static: #C77DBB;
  --s-var: #BCBEC4; --s-attr: #C77DBB; --s-tag: #56A8F5; --s-prop: #A9B7C6;
  --s-tagname: #E8BF6A; --s-sel: #E8BF6A; --s-cssprop: #BABABA; --s-cssval: #A9B7C6;
  --s-cssunit: #2AACB8; --s-md-h: #56A8F5; --s-md-link: #58A5E8;
  --s-jsx: #CF8E6D;
}
body[data-theme="light"] {
  --bg: #FFFFFF;
  --bg-panel: #F7F8FA;
  --bg-toolbar: #F7F8FA;
  --bg-title: #F7F8FA;
  --bg-elevated: #FFFFFF;
  --bg-field: #FFFFFF;
  --bg-hover: #E9EBEF;
  --bg-pressed: #DFE1E5;
  --bg-stripe-hover: #E9EBEF;
  --bg-tab-active: #FFFFFF;
  --bg-inset: #F2F3F5;

  --fg: #1F2328;
  --fg-editor: #26282E;
  --fg-dim: #5C6067;
  --fg-faint: #81858D;
  --fg-line-num: #9CA0A8;

  --border: #D0D4DA;
  --border-strong: #B4B8BF;
  --accent: #3574F0;
  --accent-hover: #2B62D6;
  --accent-dim: #BCD3F8;
  --selection: #ABCEF5;
  --selection-layer: rgba(96, 143, 214, 0.45);

  --error: #E55454; --error-bg: rgba(229, 84, 84, .14);
  --warn: #D7880B;  --warn-bg: rgba(215, 136, 11, .14);
  --weak: #8C8C94;  --weak-bg: rgba(120,120,130,.16);
  --add-green: #388A34;
  --mod-blue: #2B70C2;
  --vcs-green: #388A34;
  --vcs-blue: #2B70C2;

  --shadow-popup: 0 6px 18px rgba(0,0,0,.18), 0 2px 4px rgba(0,0,0,.10);
  --shadow-dialog: 0 16px 48px rgba(0,0,0,.28);

  --s-kw: #C7351D; --s-str: #3E833C; --s-num: #1750AD; --s-com: #8A8A8E;
  --s-fn: #0A6AC9; --s-cls: #8C7A0D; --s-const: #704DA0; --s-static: #A150A5;
  --s-var: #26282E; --s-attr: #A150A5; --s-tag: #0A6AC9; --s-prop: #26282E;
  --s-tagname: #9E7203; --s-sel: #9E7203; --s-cssprop: #5C6067; --s-cssval: #26282E;
  --s-cssunit: #1750AD; --s-md-h: #0A6AC9; --s-md-link: #0A6AC9;
}

/* ---------- reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--ui-font); font-size: 13px; color: var(--fg);
  background: var(--bg-toolbar); user-select: none;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: default; }
input, textarea, select { font: inherit; color: inherit; }
svg { display: block; }
::selection { background: var(--selection); color: inherit; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #5A5D63AA; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #6E7178CC; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }
body[data-theme="light"] ::-webkit-scrollbar-thumb { background: #C2C6CCAA; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-button { display: none; }

/* ---------- app frame ---------- */
.app { display: flex; flex-direction: column; height: 100vh; min-width: 560px; }

.titlebar {
  display: flex; align-items: center; gap: 10px; height: 30px; flex: none;
  background: var(--bg-title); border-bottom: 1px solid transparent; padding: 0 10px;
  -webkit-app-region: drag;
}
.traffic { display: flex; gap: 8px; padding-left: 2px; }
.traffic span { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.tl-red { background: #FF5F57; } .tl-yellow { background: #FEBC2E; } .tl-green { background: #28C840; }
.titlebar-wordmark { font-size: 12px; color: var(--fg-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titlebar-wordmark b { color: var(--fg); font-weight: 600; }
.platform-win .traffic, .platform-linux .traffic { display: none; }
.platform-win .titlebar { justify-content: flex-end; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; align-items: center; gap: 4px; height: 40px; flex: none;
  background: var(--bg-toolbar); border-bottom: 1px solid var(--border); padding: 0 8px;
}
.tbtn {
  width: 28px; height: 28px; border-radius: 6px; display: inline-flex; align-items: center;
  justify-content: center; flex: none; position: relative; color: var(--fg);
}
.tbtn:hover { background: var(--bg-hover); }
.tbtn:active, .tbtn.on { background: var(--bg-pressed); }
.tbtn:disabled { opacity: .4; }
.tbtn svg { width: 16px; height: 16px; }
.tbtn.badge::after {
  content: ''; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--accent); border: 1.5px solid var(--bg-toolbar);
}
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; flex: none; }
.tb-flex { flex: 1 1 auto; min-width: 12px; }

.run-config {
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px 0 8px;
  border: 1px solid var(--border-strong); border-radius: 6px; margin: 0 4px; cursor: default;
  max-width: 220px;
}
.run-config:hover { background: var(--bg-hover); }
.run-config.open { background: var(--bg-pressed); border-color: var(--accent); }
.rc-icon svg { width: 16px; height: 16px; }
.rc-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 4.5px solid var(--fg-dim); }

.tb-search {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 6px; color: var(--fg-dim);
  min-width: 210px; max-width: 330px; cursor: default;
}
.tb-search:hover { background: var(--bg-hover); color: var(--fg); }
.tb-search svg { width: 14px; height: 14px; flex: none; }
.tb-search-text { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-search-kbd { font-size: 10.5px; border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 4px; color: var(--fg-faint); }
.tb-project { font-size: 12px; color: var(--fg-dim); padding: 0 6px; white-space: nowrap; }
.tb-project svg { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; margin-right: 4px; }

/* ---------- main grid ---------- */
.main { flex: 1 1 auto; display: flex; min-height: 0; position: relative; background: var(--bg-panel); }
.center { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 220px; min-height: 0; }
.editor-area { flex: 1 1 auto; min-height: 0; position: relative; background: var(--bg); }
#editor-area > .edleaf { position: absolute; inset: 0; }
#editor-area > .edsplit { position: absolute; inset: 0; }

/* ---------- tool window stripes ---------- */
.stripe { flex: none; background: var(--bg-panel); display: flex; align-items: stretch; z-index: 5; }
.stripe-v { flex-direction: column; width: 26px; padding: 2px 0; gap: 0; border-right: 1px solid var(--border); }
#stripe-right.stripe-v { border-right: none; border-left: 1px solid var(--border); }
.stripe-h { flex-direction: row; height: 26px; padding: 0 2px; border-top: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.stripe-h::-webkit-scrollbar { display: none; }
.stripe-btn {
  position: relative; display: flex; align-items: center; justify-content: center;
  color: var(--fg-dim); cursor: default; flex: none; border-radius: 4px; margin: 1px;
}
.stripe-v .stripe-btn { flex-direction: column; gap: 3px; padding: 5px 2px; width: 24px; }
.stripe-h .stripe-btn { flex-direction: row; gap: 5px; padding: 2px 8px; height: 22px; font-size: 11.5px; }
.stripe-btn svg { width: 16px; height: 16px; }
.stripe-btn .sl-label {
  writing-mode: vertical-rl; transform: rotate(180deg); font-size: 10px; letter-spacing: .2px;
  max-height: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1;
}
.stripe-btn:hover { background: var(--bg-stripe-hover); color: var(--fg); }
.stripe-btn.active { color: var(--accent); }
.stripe-btn.active::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 2.5px;
  background: var(--accent); border-radius: 0 2px 2px 0;
}
.stripe-h .stripe-btn.active::before { left: 4px; right: 4px; top: auto; bottom: 0; width: auto; height: 2.5px; border-radius: 2px 2px 0 0; }
.stripe-btn .tw-notify { position: absolute; top: 2px; right: 2px; width: 7px; height: 7px; border-radius: 50%; background: var(--error); }
.stripe-spacer { flex: 1; }

/* ---------- docks + tool windows ---------- */
.dock { flex: none; position: relative; display: flex; min-width: 0; min-height: 0; background: var(--bg-panel); }
.dock-v { flex-direction: column; }
.dock-h { flex-direction: row; }
.dock:not(.dock-anim) .tool-window { transition: none; }
.dock.anim { transition: none; }
.tw-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; flex: 1 1 auto; }
.tool-window {
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; min-width: 0;
  overflow: hidden; background: var(--bg-panel);
}
.tool-window.tw-opening { animation: twOpen .16s ease-out; }
@keyframes twOpen { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.tw-header {
  display: flex; align-items: center; height: 26px; flex: none; padding: 0 2px 0 8px;
  border-bottom: 1px solid var(--border); gap: 4px; background: var(--bg-panel);
}
.tw-title { font-size: 11.5px; font-weight: 500; letter-spacing: .3px; text-transform: uppercase; color: var(--fg-dim); white-space: nowrap; }
.tw-title .tw-count { color: var(--fg-faint); font-weight: 400; margin-left: 4px; }
.tw-header .tbtn { width: 22px; height: 22px; }
.tw-header .tbtn svg { width: 14px; height: 14px; }
.tw-tabs { display: flex; gap: 2px; margin-left: 6px; }
.tw-tab { padding: 2px 8px; border-radius: 5px; font-size: 12px; color: var(--fg-dim); }
.tw-tab:hover { background: var(--bg-hover); }
.tw-tab.on { background: var(--bg-pressed); color: var(--fg); }
.tw-body { flex: 1 1 auto; min-height: 0; display: flex; overflow: hidden; position: relative; }
.tw-body > * { min-width: 0; min-height: 0; }

.tw-splitter { flex: none; background: transparent; position: relative; z-index: 6; }
.tw-splitter.h { width: 4px; cursor: col-resize; margin: 0 -2px; }
.tw-splitter.v { height: 4px; cursor: row-resize; margin: -2px 0; }
.tw-splitter::after { content: ''; position: absolute; background: var(--border); }
.tw-splitter.h::after { left: 1.5px; top: 0; bottom: 0; width: 1px; }
.tw-splitter.v::after { top: 1.5px; left: 0; right: 0; height: 1px; }
.tw-splitter:hover::after, .tw-splitter.drag::after { background: var(--accent); }

/* ---------- editor tabs ---------- */
.tabstrip-wrap { display: flex; align-items: stretch; height: 34px; flex: none; background: var(--bg-panel); border-bottom: 1px solid var(--border); }
.tabstrip { display: flex; align-items: stretch; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
.tabstrip::-webkit-scrollbar { display: none; }
.etab {
  display: inline-flex; align-items: center; gap: 7px; padding: 0 6px 0 10px; height: 33px;
  font-size: 12.5px; color: var(--fg-dim); position: relative; flex: none; max-width: 220px;
  cursor: default; border-right: 1px solid transparent;
}
.etab .etab-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etab svg { width: 15px; height: 15px; flex: none; }
.etab:hover { background: var(--bg-hover); color: var(--fg); }
.etab.active { color: var(--fg); background: var(--bg-tab-active); }
.etab.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent);
}
.etab.modified .etab-label::after { content: ' ✱'; color: var(--warn); font-size: 12px; }
.etab.modified-newui .etab-label::after { content: ''; }
.etab .etab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mod-blue); flex: none; }
.etab .etab-pin { width: 13px; height: 13px; color: var(--fg-dim); flex: none; display: none; }
.etab.pinned .etab-pin { display: inline-flex; }
.etab .etab-close {
  width: 18px; height: 18px; border-radius: 4px; display: inline-flex; align-items: center;
  justify-content: center; color: var(--fg-dim); flex: none; visibility: hidden;
}
.etab .etab-close svg { width: 11px; height: 11px; }
.etab:hover .etab-close, .etab.active .etab-close { visibility: visible; }
.etab .etab-close:hover { background: var(--bg-pressed); color: var(--fg); }
.etab.pinned:not(:hover) .etab-close { visibility: hidden; }
.etab.drop-target { box-shadow: inset 0 -2px 0 var(--accent); }
.tab-more {
  width: 26px; display: inline-flex; align-items: center; justify-content: center; flex: none;
  color: var(--fg-dim); border-left: 1px solid transparent;
}
.tab-more:hover { background: var(--bg-hover); color: var(--fg); }
.tab-more svg { width: 14px; height: 14px; }
.tab-scroll { width: 17px; display: inline-flex; align-items: center; justify-content: center; color: var(--fg-dim); flex: none; }
.tab-scroll:hover { color: var(--fg); background: var(--bg-hover); }
.tab-scroll svg { width: 10px; height: 10px; }
.tab-scroll.hidden { display: none; }

/* ---------- breadcrumbs ---------- */
.breadcrumbs {
  display: flex; align-items: center; gap: 1px; height: 25px; flex: none; padding: 0 6px;
  background: var(--bg); border-top: 1px solid var(--border); overflow-x: auto; scrollbar-width: none;
  font-size: 12px; color: var(--fg-dim);
}
.breadcrumbs::-webkit-scrollbar { display: none; }
.crumb { display: inline-flex; align-items: center; gap: 4px; padding: 2px 5px; border-radius: 4px; white-space: nowrap; }
.crumb svg { width: 13px; height: 13px; }
.crumb:hover { background: var(--bg-hover); color: var(--fg); }
.crumb-sep { color: var(--fg-faint); font-size: 10px; padding: 0 1px; }
.crumb.sym-method { color: var(--s-cls); }

/* ---------- editor ---------- */
.edgroup { position: absolute; inset: 0; display: flex; flex-direction: column; }
.edsplit { position: absolute; inset: 0; display: flex; }
.edsplit.vert { flex-direction: row; } .edsplit.horiz { flex-direction: column; }
.edsplit > .edleaf { flex: 1 1 50%; min-width: 120px; min-height: 60px; position: relative; }
.edsplit-divider { flex: none; background: var(--border); position: relative; z-index: 3; }
.edsplit.vert > .edsplit-divider { width: 3px; cursor: col-resize; }
.edsplit.horiz > .edsplit-divider { height: 3px; cursor: row-resize; }
.edsplit-divider:hover, .edsplit-divider.drag { background: var(--accent); z-index: 4; }
.edleaf { display: flex; flex-direction: column; background: var(--bg); min-height: 0; }
.edleaf:focus-within .tabstrip-wrap { }
.editor-host { flex: 1 1 auto; position: relative; min-height: 0; background: var(--bg); overflow: hidden; }
.editor {
  position: absolute; inset: 0; overflow: hidden; background: var(--bg);
  font-family: var(--mono-font); font-size: var(--ed-font-size, 14px); line-height: var(--ed-line-h, 21px);
  color: var(--fg-editor); cursor: text;
}
.editor .ed-scroll { position: absolute; inset: 0; overflow: auto; }
.editor .ed-sizer { position: relative; min-width: 100%; }
.editor .ed-spacer-top, .editor .ed-spacer-bottom { width: 1px; }
.ed-lines { position: relative; width: max-content; min-width: 100%; }
.ed-line { position: relative; height: var(--ed-line-h, 21px); white-space: pre; }
.ed-line.hidden-fold { display: none; }
.ed-line.current > .ed-line-bg { position: absolute; left: 0; right: 0; top: 0; bottom: 0; background: var(--bg-inset); }
body[data-theme="dark"] .ed-line.current > .ed-line-bg { background: #2A2C30; }
.ed-line .fold-ellipsis {
  display: inline-block; background: #43454A66; color: var(--fg-dim); border-radius: 3px;
  padding: 0 5px; margin: 1px 2px; line-height: 17px; cursor: default;
}
.fold-ellipsis:hover { background: var(--accent); color: #fff; }
body[data-theme="light"] .fold-ellipsis { background: #E6E8EB; }

/* tokens */
.tk-kw { color: var(--s-kw); } .tk-str { color: var(--s-str); } .tk-num { color: var(--s-num); }
.tk-com { color: var(--s-com); font-style: italic; } .tk-fn { color: var(--s-fn); }
.tk-cls { color: var(--s-cls); } .tk-const { color: var(--s-const); } .tk-static { color: var(--s-static); }
.tk-var { } .tk-tag { color: var(--s-tagname); } .tk-attr { color: var(--s-attr); }
.tk-prop { color: var(--s-prop); } .tk-op { color: var(--fg-editor); }
.tk-mdh { color: var(--s-md-h); font-weight: 600; } .tk-mdlink { color: var(--s-md-link); text-decoration: underline; }
.tk-sel { color: var(--s-sel); } .tk-cssprop { color: var(--s-cssprop); } .tk-cssval { color: var(--s-cssval); }
.tk-cssunit { color: var(--s-cssunit); } .tk-meta { color: var(--s-kw); }
.tk-heredoc { color: var(--s-str); }

/* squiggles + highlights over tokens */
.sq { text-decoration-line: underline; text-decoration-style: wavy; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.sq-error { text-decoration-color: var(--error); background: var(--error-bg); border-radius: 2px; }
.sq-warn { text-decoration-color: var(--warn); background: var(--warn-bg); border-radius: 2px; }
.sq-weak { text-decoration-color: var(--weak); text-decoration-style: dotted; }
.sq-info { text-decoration-color: var(--info-blue); }
.hl-word { background: #5A4B20; border-radius: 2px; }
body[data-theme="light"] .hl-word { background: #F2E05A; color: #26282E; }
.hl-find { background: #3D4A1E; border-radius: 2px; }
body[data-theme="light"] .hl-find { background: #E9E98C; }
.hl-find-cur { background: #7A6A1C !important; outline: 1px solid #B7A64B; }
body[data-theme="light"] .hl-find-cur { background: #F5D445 !important; outline: 1px solid #C4A800; color: #26282E; }
.hl-usages { background: #37589C; border-radius: 2px; }
body[data-theme="light"] .hl-usages { background: #C7DDF9; }

/* selection + carets */
.ed-sel { position: absolute; background: var(--selection-layer); border-radius: 1px; pointer-events: none; mix-blend-mode: normal; }
.ed-caret { position: absolute; width: 2px; background: #DDDDDD; pointer-events: none; animation: caretBlink 1.06s steps(1) infinite; }
body[data-theme="light"] .ed-caret { background: #26282E; }
.editor.column-mode .ed-caret { width: 2.5px; }
@keyframes caretBlink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
.ed-caret.stopped { animation: none; opacity: 1; }
.ed-bracket { position: absolute; border: 1px solid var(--fg-faint); border-radius: 2px; pointer-events: none; }
.ed-inlay { position: absolute; color: var(--fg-faint); font-size: 12px; pointer-events: auto; padding: 0 3px; border-radius: 3px; white-space: nowrap; }
.ed-inlay:hover { background: var(--bg-hover); color: var(--fg); }
.ed-inlay.hint { color: #5E6C86; }
body[data-theme="light"] .ed-inlay.hint { color: #4E6178; }
.ed-indent-guide { position: absolute; width: 1px; pointer-events: none; background: color-mix(in srgb, var(--fg-editor) 14%, transparent); }

/* gutter */
.ed-gutter {
  position: absolute; left: 0; top: 0; bottom: 0; z-index: 2; display: flex; flex-direction: column;
  background: var(--bg); overflow: hidden; cursor: default; font-family: var(--mono-font);
  font-size: calc(var(--ed-font-size, 14px) - 1.5px); line-height: var(--ed-line-h, 21px);
}
.g-row { display: flex; align-items: center; height: var(--ed-line-h, 21px); flex: none; }
.g-row.hidden-fold { display: none; }
.g-icon { width: 18px; flex: none; display: flex; justify-content: center; align-items: center; }
.g-icon svg { width: 13px; height: 13px; }
.g-icon .g-run { color: #499C54; } .g-icon .g-bookmark { color: #57AAF7; }
.g-num { flex: none; text-align: right; color: var(--fg-line-num); padding-right: 8px; width: var(--g-num-w, 34px); }
.g-row.current .g-num { color: var(--fg); }
.g-fold { width: 14px; flex: none; display: flex; justify-content: center; align-items: center; color: var(--fg-faint); border-radius: 3px; }
.g-fold:hover { color: var(--fg); background: var(--bg-hover); }
.g-fold svg { width: 9px; height: 9px; transition: transform .12s ease; }
.g-vcs { width: 3px; flex: none; align-self: stretch; margin-left: 1px; }
.g-vcs.added { background: var(--vcs-green); } .g-vcs.changed { background: var(--vcs-blue); }
.g-hl-current { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--fg-editor) 6%, transparent); z-index: -1; }

/* error stripe (marker bar) */
.ed-stripe-bar { position: absolute; right: 0; top: 0; bottom: 0; width: 14px; z-index: 3; background: var(--bg); border-left: 1px solid var(--border); cursor: pointer; }
.ed-stripe-bar:hover { background: var(--bg-inset); }
.stripe-mark { position: absolute; left: 2px; right: 2px; border-radius: 1.5px; min-height: 3px; }
.stripe-mark.m-error { background: var(--error); } .stripe-mark.m-warn { background: var(--warn); }
.stripe-mark.m-weak { background: var(--weak); } .stripe-mark.m-info { background: var(--info-blue); }
.stripe-mark:hover { outline: 1px solid var(--fg); }

/* editor overlays */
.ed-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 18px; color: var(--fg-dim); background: var(--bg); z-index: 5;
}
.ed-empty-logo svg { width: 76px; height: 76px; opacity: .9; }
.ed-empty h2 { font-size: 17px; font-weight: 500; color: var(--fg-dim); }
.ed-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(210px, 1fr)); gap: 5px 40px; font-size: 12px; }
.ed-shortcuts .sc { display: flex; justify-content: space-between; gap: 18px; padding: 3px 8px; border-radius: 5px; }
.ed-shortcuts .sc:hover { background: var(--bg-hover); }
.ed-shortcuts kbd { font-family: var(--ui-font); color: var(--fg); font-size: 11px; background: var(--bg-inset); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }
.ed-empty-links { display: flex; gap: 10px; }
.ed-empty-links button { color: var(--accent); padding: 4px 8px; border-radius: 5px; }
.ed-empty-links button:hover { background: var(--bg-hover); }

/* find bar */
.findbar {
  display: none; flex-direction: column; border-bottom: 1px solid var(--border); background: var(--bg-panel);
  position: absolute; top: 0; right: 14px; z-index: 20; border-radius: 0 0 8px 8px; box-shadow: var(--shadow-popup);
  min-width: 420px; max-width: calc(100% - 30px);
}
.findbar.open { display: flex; }
.findbar-row { display: flex; align-items: center; gap: 4px; padding: 5px 8px; }
.find-input {
  flex: 1; height: 28px; background: var(--bg-field); border: 1px solid var(--border-strong);
  border-radius: 5px; padding: 0 8px; font-size: 13px; color: var(--fg); outline: none; user-select: text;
}
.find-input:focus { border-color: var(--accent); }
.find-input.err { border-color: var(--error); }
.find-count { font-size: 11.5px; color: var(--fg-dim); white-space: nowrap; padding: 0 4px; min-width: 56px; text-align: center; }
.fbtn { width: 24px; height: 24px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; color: var(--fg-dim); flex: none; }
.fbtn:hover { background: var(--bg-hover); color: var(--fg); }
.fbtn.on { color: var(--accent); background: var(--bg-inset); }
.fbtn svg { width: 14px; height: 14px; }
.findbar-row.replace { border-top: 1px solid var(--border); }

/* ---------- popups / menus ---------- */
.popup {
  position: fixed; z-index: 1000; background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: 8px; box-shadow: var(--shadow-popup); overflow: hidden; animation: popupIn .1s ease-out;
}
@keyframes popupIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.menu { min-width: 200px; max-height: 70vh; overflow-y: auto; padding: 5px; }
.menu-item {
  display: flex; align-items: center; gap: 9px; padding: 4px 10px; border-radius: 5px;
  font-size: 12.5px; color: var(--fg); cursor: default; white-space: nowrap; position: relative;
}
.menu-item:hover:not(.disabled), .menu-item.hl:not(.disabled) { background: var(--bg-hover); }
.menu-item.disabled { color: var(--fg-faint); opacity: .6; }
.menu-item .mi-icon { width: 16px; height: 16px; flex: none; display: inline-flex; justify-content: center; }
.menu-item .mi-icon svg { width: 15px; height: 15px; }
.menu-item .mi-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.menu-item .mi-cut { font-size: 11px; color: var(--fg-dim); padding-left: 24px; }
.menu-item .mi-sub { color: var(--fg-dim); font-size: 10px; }
.menu-item .mi-check { width: 14px; flex: none; color: var(--accent); font-size: 12px; }
.menu-sep { height: 1px; background: var(--border); margin: 5px 8px; }
.menu-title { padding: 6px 10px 3px; font-size: 11px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: .4px; }

/* dropdown lists (completion, search) */
.dd-list { overflow-y: auto; padding: 3px; }
.dd-row {
  display: flex; align-items: center; gap: 7px; padding: 3px 8px; border-radius: 5px;
  font-size: 12.5px; cursor: default; white-space: nowrap; color: var(--fg);
}
.dd-row svg, .dd-row .dd-ico { width: 15px; height: 15px; flex: none; display: inline-flex; justify-content: center; }
.dd-row .dd-label { overflow: hidden; text-overflow: ellipsis; }
.dd-row .dd-label b { color: var(--fg); font-weight: 600; }
.dd-row .dd-label i { font-style: normal; color: var(--fg-faint); }
.dd-row .dd-meta { margin-left: auto; color: var(--fg-faint); font-size: 11px; padding-left: 20px; }
.dd-row.selected { background: var(--accent); color: #fff; }
.dd-row.selected .dd-label b, .dd-row.selected .dd-meta, .dd-row.selected .dd-label i { color: #E8EEFF; }
.dd-row.selected svg .ico-fill { fill: #fff !important; }
.dd-header { padding: 6px 12px 4px; font-size: 11px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: .4px; }
.dd-footer {
  display: flex; gap: 14px; padding: 5px 12px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--fg-faint);
}
.dd-empty { padding: 18px 14px; text-align: center; color: var(--fg-faint); font-size: 12.5px; }

/* completion popup */
.completion-popup { width: 380px; max-height: 266px; display: flex; flex-direction: column; }
.completion-popup .dd-list { flex: 1; }
.cp-row .cp-type { font-size: 11px; color: var(--fg-dim); }
.cp-row.selected .cp-type { color: #D7E3FF; }
.completion-doc { border-left: 1px solid var(--border); width: 300px; overflow-y: auto; padding: 10px 12px; font-size: 12px; color: var(--fg-dim); user-select: text; }
.completion-wrap { display: flex; max-height: 280px; }

/* parameter hints popup */
.param-hint { border-radius: 6px; overflow: visible; }
.param-hint-inner { display: flex; align-items: center; gap: 2px; padding: 6px 8px; font-family: var(--mono-font); font-size: 12.5px; max-width: 560px; flex-wrap: wrap; }
.ph-param { padding: 1px 4px; border-radius: 4px; color: var(--fg-dim); }
.ph-param .ph-type { color: var(--s-kw); font-size: 11.5px; }
.ph-param.cur { background: var(--accent); color: #fff; }
.ph-param.cur .ph-type { color: #D7E3FF; }
.ph-param.obsolete { text-decoration: line-through; opacity: .55; }

/* quick documentation */
.quickdoc { width: 420px; max-width: 90vw; max-height: 340px; overflow-y: auto; padding: 12px 14px; font-size: 12.5px; user-select: text; }
.qd-signature { font-family: var(--mono-font); font-size: 12px; color: var(--fg); background: var(--bg-inset); padding: 7px 9px; border-radius: 6px; margin-bottom: 9px; white-space: pre-wrap; }
.qd-desc { color: var(--fg-dim); line-height: 1.5; margin-bottom: 8px; white-space: pre-wrap; }
.qd-sec { margin-top: 8px; }
.qd-sec h4 { font-size: 11px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.qd-param { display: flex; gap: 8px; margin: 3px 0; }
.qd-param code { font-family: var(--mono-font); color: var(--s-cls); font-size: 11.5px; flex: none; }
.qd-param .qd-ptype { font-family: var(--mono-font); color: var(--s-kw); font-size: 11.5px; flex: none; }
.qd-param span { color: var(--fg-dim); }
.qd-returns code { color: var(--s-kw); }

/* tooltip */
.tooltip {
  position: fixed; z-index: 1200; background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: 7px; box-shadow: var(--shadow-popup); padding: 8px 11px; font-size: 12.5px;
  color: var(--fg); max-width: 380px; animation: popupIn .1s ease-out; user-select: text;
}
.tooltip .tt-title { font-weight: 600; margin-bottom: 3px; display: flex; gap: 6px; align-items: center; }
.tooltip .tt-body { color: var(--fg-dim); line-height: 1.45; }
.tooltip .tt-hint { color: var(--fg-faint); font-size: 11px; margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--border); }
.tooltip .tt-hint kbd { background: var(--bg-inset); border: 1px solid var(--border); border-radius: 3px; padding: 0 4px; font-size: 10px; }

/* lightbulb */
.lightbulb {
  position: absolute; z-index: 8; width: 17px; height: 17px; cursor: pointer; color: var(--warn);
  display: flex; align-items: center; justify-content: center;
}
.lightbulb svg { width: 16px; height: 16px; }
.lightbulb.error { color: var(--error); }
.lightbulb:hover { filter: brightness(1.2); }

/* search everywhere */
.se-popup {
  position: fixed; z-index: 1100; top: 12vh; left: 50%; transform: translateX(-50%);
  width: min(680px, 92vw); background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: 10px; box-shadow: var(--shadow-dialog); display: flex; flex-direction: column;
  overflow: hidden; animation: popupIn .12s ease-out; max-height: 68vh;
}
.se-input-row { display: flex; align-items: center; gap: 9px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.se-input-row svg { width: 16px; height: 16px; color: var(--fg-dim); flex: none; }
.se-input { flex: 1; background: none; border: none; outline: none; font-size: 15px; color: var(--fg); user-select: text; }
.se-tabs { display: flex; gap: 2px; padding: 5px 10px 0; border-bottom: 1px solid var(--border); }
.se-tab { padding: 4px 11px; border-radius: 6px 6px 0 0; font-size: 12px; color: var(--fg-dim); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.se-tab:hover { background: var(--bg-hover); }
.se-tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.se-results { flex: 1; overflow-y: auto; padding: 5px; min-height: 120px; }
.se-footer { display: flex; gap: 16px; padding: 6px 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--fg-faint); }

/* ---------- dialogs ---------- */
.dialog-layer { position: fixed; inset: 0; z-index: 2000; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.4); }
.dialog-layer.open { display: flex; }
.dialog {
  background: var(--bg-panel); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: var(--shadow-dialog); display: flex; flex-direction: column; min-width: 420px;
  max-width: 92vw; max-height: 86vh; animation: dlgIn .13s ease-out;
}
@keyframes dlgIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.dialog-header { display: flex; align-items: center; padding: 13px 16px 11px; gap: 10px; }
.dialog-title { font-size: 15px; font-weight: 600; flex: 1; }
.dialog-body { padding: 2px 16px 14px; overflow: auto; min-height: 0; color: var(--fg); }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }
.btn {
  height: 28px; padding: 0 15px; border-radius: 6px; border: 1px solid var(--border-strong);
  background: var(--bg-field); color: var(--fg); font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--bg-hover); }
.btn.default { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.default:hover { background: var(--accent-hover); }
.btn.disabled, .btn:disabled { opacity: .45; }
.btn.link { border: none; background: none; color: var(--accent); padding: 0 6px; }
.btn.link:hover { background: var(--bg-hover); }
.field-label { font-size: 12px; color: var(--fg-dim); margin: 11px 0 5px; display: block; }
.text-input, .select-input {
  width: 100%; height: 29px; background: var(--bg-field); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 0 9px; outline: none; user-select: text; color: var(--fg);
}
.text-input:focus, .select-input:focus { border-color: var(--accent); }
textarea.text-input { height: auto; padding: 7px 9px; resize: vertical; line-height: 1.45; }
.checkbox { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: default; font-size: 12.5px; }
.checkbox .cb-box {
  width: 15px; height: 15px; border: 1px solid var(--border-strong); border-radius: 4px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
.checkbox.on .cb-box { background: var(--accent); border-color: var(--accent); }
.checkbox .cb-box svg { width: 10px; height: 10px; }
.radio-row { display: flex; gap: 16px; padding: 4px 0; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; }
.segmented button { padding: 4px 13px; font-size: 12px; color: var(--fg-dim); }
.segmented button.on { background: var(--bg-pressed); color: var(--fg); }

/* settings dialog */
.settings-dialog { width: min(880px, 94vw); height: min(600px, 88vh); }
.settings-body { display: flex; min-height: 0; flex: 1; }
.settings-search { padding: 0 16px 10px; }
.settings-tree { width: 250px; flex: none; border-right: 1px solid var(--border); overflow-y: auto; padding: 8px 6px; }
.stree-node { display: flex; align-items: center; gap: 7px; padding: 3.5px 8px; border-radius: 5px; font-size: 12.5px; color: var(--fg); white-space: nowrap; }
.stree-node svg { width: 14px; height: 14px; opacity: .8; }
.stree-node:hover { background: var(--bg-hover); }
.stree-node.on { background: var(--accent); color: #fff; }
.stree-node .stree-hit { background: #6B5A1E; border-radius: 2px; }
.stree-node.on .stree-hit { background: #3D5CA8; }
.settings-page { flex: 1; overflow-y: auto; padding: 14px 18px; min-width: 0; }
.settings-page h3 { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.settings-page .sp-row { display: flex; align-items: center; gap: 10px; margin: 9px 0; font-size: 12.5px; }
.settings-page .sp-row > label { width: 190px; flex: none; color: var(--fg-dim); }
.settings-page .sp-section { margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--border); }
.settings-page .sp-section > h4 { font-size: 12px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 2px; }

/* keymap table */
.km-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.km-table th { text-align: left; color: var(--fg-faint); font-weight: 500; font-size: 11px; text-transform: uppercase; padding: 4px 8px; border-bottom: 1px solid var(--border); }
.km-table td { padding: 3.5px 8px; border-bottom: 1px solid var(--border); }
.km-table tr:hover td { background: var(--bg-hover); }
.kbd-chip { display: inline-flex; align-items: center; background: var(--bg-inset); border: 1px solid var(--border-strong); border-radius: 4px; padding: 1px 7px; font-size: 11px; font-family: var(--ui-font); margin-right: 4px; }
.kbd-chip.recording { border-color: var(--warn); color: var(--warn); animation: caretBlink 1s infinite; }

/* inspections list */
.insp-row { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border-radius: 5px; font-size: 12.5px; }
.insp-row:hover { background: var(--bg-hover); }
.insp-row .insp-name { flex: 1; }
.insp-row select { background: var(--bg-field); border: 1px solid var(--border-strong); border-radius: 5px; height: 24px; font-size: 12px; color: var(--fg); }

/* ---------- status bar ---------- */
.statusbar {
  display: flex; align-items: center; height: 26px; flex: none; background: var(--bg-panel);
  border-top: 1px solid var(--border); padding: 0 6px; gap: 2px; font-size: 12px; color: var(--fg-dim);
  overflow: hidden;
}
.sb-widget { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 5px; height: 22px; white-space: nowrap; }
.sb-widget:hover { background: var(--bg-hover); color: var(--fg); }
.sb-widget svg { width: 13px; height: 13px; }
.sb-widget.sb-right { margin-left: 2px; }
.sb-flex { flex: 1; }
.sb-progress { display: inline-flex; align-items: center; gap: 8px; overflow: hidden; }
.sb-progress .sb-ptext { white-space: nowrap; }
.pbar { width: 90px; height: 8px; border-radius: 4px; background: var(--bg-inset); overflow: hidden; position: relative; }
.pbar .pbar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .2s ease; }
.pbar.indet .pbar-fill { width: 40% !important; animation: pbIndet 1.1s ease-in-out infinite alternate; }
@keyframes pbIndet { from { margin-left: -20%; } to { margin-left: 100%; } }
.sb-problems .err { color: var(--error); font-weight: 500; }
.sb-problems .wrn { color: var(--warn); font-weight: 500; }
.sb-col-mode { color: var(--accent); display: none; }
.app.column-mode .sb-col-mode { display: inline-flex; }

/* ---------- trees ---------- */
.tree { overflow: auto; flex: 1; padding: 3px 0 12px; user-select: none; }
.tree-row {
  display: flex; align-items: center; gap: 6px; padding: 1.5px 8px 1.5px 6px; border-radius: 4px;
  font-size: 12.5px; cursor: default; white-space: nowrap; position: relative; color: var(--fg);
}
.tree-row svg { width: 15px; height: 15px; flex: none; }
.tree-row .tree-label { overflow: hidden; text-overflow: ellipsis; }
.tree-row .tree-meta { margin-left: auto; color: var(--fg-faint); font-size: 11px; padding-left: 10px; }
.tree-row:hover { background: var(--bg-hover); }
.tree-row.selected { background: var(--accent); color: #fff; }
.tree-row.selected svg .ico-fill { fill: #fff !important; }
.tree-row.selected .tree-meta { color: #D7E3FF; }
.tree-row.current-file { color: var(--fg); font-weight: 500; }
.tree-row.current-file:not(.selected) { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.tree-row .tree-caret { width: 15px; height: 15px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--fg-dim); border-radius: 3px; }
.tree-row .tree-caret:hover { background: var(--bg-pressed); color: var(--fg); }
.tree-row .tree-caret svg { width: 9px; height: 9px; transition: transform .12s ease; }
.tree-caret.open svg { transform: rotate(90deg); }
.tree-row.drop-into { outline: 1px solid var(--accent); }
.tree-empty { padding: 16px 14px; color: var(--fg-faint); font-size: 12.5px; text-align: center; }
.tree-speed-search {
  position: absolute; top: 4px; right: 8px; z-index: 5; background: var(--bg-field);
  border: 1px solid var(--accent); border-radius: 5px; padding: 2px 8px; font-size: 12px;
  box-shadow: var(--shadow-popup);
}

/* ---------- problems / find / todo tool windows ---------- */
.problem-row { display: flex; align-items: center; gap: 7px; padding: 2px 10px; font-size: 12.5px; cursor: default; white-space: nowrap; }
.problem-row svg { width: 14px; height: 14px; flex: none; }
.problem-row .pr-text { overflow: hidden; text-overflow: ellipsis; color: var(--fg); }
.problem-row .pr-loc { margin-left: auto; color: var(--fg-faint); font-size: 11.5px; padding-left: 16px; }
.problem-row:hover { background: var(--bg-hover); }
.tw-toolbar { display: flex; align-items: center; gap: 3px; padding: 4px 8px; border-bottom: 1px solid var(--border); flex: none; }
.tw-toolbar .fbtn.on { color: var(--accent); }
.filter-input { height: 25px; background: var(--bg-field); border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 8px; font-size: 12px; outline: none; width: 150px; user-select: text; }
.filter-input:focus { border-color: var(--accent); }
.badge-count { background: var(--bg-pressed); border-radius: 8px; padding: 0 6px; font-size: 10.5px; color: var(--fg-dim); }

/* ---------- terminal ---------- */
.terminal {
  flex: 1; overflow-y: auto; padding: 6px 10px; font-family: var(--mono-font); font-size: 12.5px;
  line-height: 1.5; background: var(--bg); color: var(--fg-editor); cursor: text; user-select: text; white-space: pre-wrap; word-break: break-word;
}
.terminal .t-green { color: #6AAB73; } .terminal .t-blue { color: #56A8F5; } .terminal .t-yellow { color: #F0A72C; }
.terminal .t-red { color: var(--error); } .terminal .t-dim { color: var(--fg-faint); } .terminal .t-bold { font-weight: 700; }
.terminal .t-cyan { color: #2AACB8; }
.term-prompt { color: #6AAB73; } .term-prompt .term-path { color: #56A8F5; }
.term-input-row { display: inline; }
.term-caret { display: inline-block; width: 7px; height: 14px; background: var(--fg-editor); vertical-align: -2px; animation: caretBlink 1.06s steps(1) infinite; }

/* ---------- run console ---------- */
.run-console {
  flex: 1; overflow: auto; padding: 6px 12px; font-family: var(--mono-font); font-size: 12.5px;
  line-height: 1.55; background: #212224; color: #C9CCD1; user-select: text; white-space: pre-wrap; word-break: break-word;
}
body[data-theme="light"] .run-console { background: #FBFBFC; color: #26282E; }
.run-console .rc-green { color: #6AAB73; } .run-console .rc-red { color: var(--error); }
.run-console .rc-yellow { color: #F0A72C; } .run-console .rc-blue { color: #56A8F5; }
.run-console .rc-dim { color: var(--fg-faint); } .run-console .rc-bold { font-weight: 700; }
.run-console a { color: #58A5E8; text-decoration: underline; cursor: pointer; }
.run-console .rc-progress-bar { color: #6AAB73; }
.console-input-row { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-top: 1px solid var(--border); }
.console-input-row .ci-prompt { color: #6AAB73; font-family: var(--mono-font); font-size: 12.5px; }
.console-input { flex: 1; background: none; border: none; outline: none; font-family: var(--mono-font); font-size: 12.5px; color: var(--fg-editor); user-select: text; }

/* ---------- git log / commit ---------- */
.git-graph { display: flex; min-height: 0; flex: 1; }
.git-commits { width: 46%; flex: none; overflow-y: auto; border-right: 1px solid var(--border); min-width: 300px; }
.commit-row { display: flex; gap: 6px; padding: 5px 10px 5px 4px; cursor: default; position: relative; font-size: 12.5px; }
.commit-row:hover { background: var(--bg-hover); }
.commit-row.selected { background: var(--accent); color: #fff; }
.commit-row.selected .cm-meta { color: #D7E3FF; }
.commit-gutter { width: 26px; flex: none; position: relative; }
.commit-gutter .cg-node { position: absolute; width: 9px; height: 9px; border-radius: 50%; border: 2px solid; }
.commit-gutter .cg-line { position: absolute; width: 2px; background: var(--border-strong); }
.commit-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.commit-msg .cm-refs { color: var(--accent); font-size: 11px; margin-right: 5px; }
.commit-row.selected .cm-refs { color: #CFE0FF; }
.cm-meta { color: var(--fg-faint); font-size: 11px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; }
.commit-detail { flex: 1; overflow-y: auto; padding: 10px 14px; min-width: 0; }
.commit-detail h4 { font-size: 13px; margin-bottom: 6px; }
.cd-meta-row { color: var(--fg-dim); font-size: 12px; margin: 3px 0; }
.cd-files { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.cd-file { display: flex; align-items: center; gap: 7px; padding: 3px 6px; border-radius: 5px; font-size: 12.5px; cursor: default; }
.cd-file:hover { background: var(--bg-hover); }
.cd-file svg { width: 14px; height: 14px; }
.cd-file .cdf-count { margin-left: auto; font-family: var(--mono-font); font-size: 11px; }
.cd-file .cdf-add { color: var(--vcs-green); } .cd-file .cdf-del { color: var(--error); }

.commit-panel { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.commit-files { flex: 1 1 40%; overflow-y: auto; min-height: 60px; border-bottom: 1px solid var(--border); padding: 4px 0; }
.commit-msg-area { flex: none; padding: 8px 10px 4px; display: flex; flex-direction: column; gap: 5px; }
.commit-msg-area textarea { min-height: 56px; }
.commit-actions { display: flex; align-items: center; gap: 8px; padding: 6px 10px 10px; }
.commit-hint { font-size: 11px; color: var(--fg-faint); }
.cf-row { display: flex; align-items: center; gap: 7px; padding: 2px 10px; font-size: 12.5px; cursor: default; }
.cf-row:hover { background: var(--bg-hover); }
.cf-row .cf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-row .cf-status { margin-left: auto; font-size: 11px; color: var(--fg-faint); flex: none; }
.cf-row .cf-status.new { color: var(--vcs-green); } .cf-row .cf-status.mod { color: var(--vcs-blue); }
.vcs-diff-preview { flex: 1 1 60%; border-top: 1px solid var(--border); min-height: 80px; }

/* ---------- diff viewer ---------- */
.diff-view { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--bg); }
.diff-header { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--bg-panel); flex: none; }
.diff-title { font-size: 12.5px; }
.diff-title .dt-side { color: var(--fg-dim); }
.diff-pane-wrap { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.diff-pane { flex: 1 1 50%; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.diff-pane + .diff-pane { border-left: 1px solid var(--border); }
.diff-pane-titles { display: flex; flex: none; border-bottom: 1px solid var(--border); }
.diff-pane-title { flex: 1; padding: 4px 10px; font-size: 12px; color: var(--fg-dim); background: var(--bg-panel); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diff-scroll { flex: 1; overflow: auto; font-family: var(--mono-font); font-size: 12.5px; line-height: 19px; position: relative; }
.diff-lines { min-width: 100%; width: max-content; padding-bottom: 12px; }
.dline { display: flex; white-space: pre; min-height: 19px; }
.dline .dl-num { width: 42px; flex: none; text-align: right; padding-right: 8px; color: var(--fg-line-num); font-size: 11px; user-select: none; }
.dline .dl-marker { width: 8px; flex: none; }
.dline.add { background: rgba(70, 160, 80, .14); } .dline.add .dl-marker { background: var(--vcs-green); }
.dline.del { background: rgba(230, 90, 90, .14); } .dline.del .dl-marker { background: var(--error); }
.dline .dl-content { padding-left: 6px; color: var(--fg-editor); }
.dline.add .dl-content .w-add { background: rgba(70, 160, 80, .3); border-radius: 2px; }
.dline.del .dl-content .w-del { background: rgba(230, 90, 90, .3); border-radius: 2px; }
.dline.expander { color: var(--accent); cursor: pointer; background: var(--bg-inset); }
.dline.expander:hover { background: var(--bg-hover); }

/* ---------- notifications ---------- */
.balloon-layer { position: fixed; right: 12px; bottom: 34px; z-index: 1500; display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none; }
.balloon {
  width: 360px; max-width: 92vw; background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: 9px; box-shadow: var(--shadow-popup); padding: 10px 12px 9px; pointer-events: auto;
  display: flex; gap: 10px; animation: balloonIn .18s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes balloonIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.balloon.closing { opacity: 0; transform: translateY(6px); transition: all .15s ease-in; }
.balloon svg.b-ico { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.balloon .b-content { flex: 1; min-width: 0; }
.balloon .b-title { font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.balloon .b-text { font-size: 12px; color: var(--fg-dim); line-height: 1.45; }
.balloon .b-actions { display: flex; gap: 6px; margin-top: 8px; }
.balloon .b-close { flex: none; width: 20px; height: 20px; border-radius: 4px; color: var(--fg-dim); display: flex; align-items: center; justify-content: center; }
.balloon .b-close:hover { background: var(--bg-hover); color: var(--fg); }
.balloon .b-close svg { width: 11px; height: 11px; }

/* ---------- misc ---------- */
.spinner {
  width: 13px; height: 13px; border: 2px solid var(--border-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.list-toolbar-right { margin-left: auto; display: flex; gap: 3px; }
.kbd { font-family: var(--ui-font); font-size: 11px; background: var(--bg-inset); border: 1px solid var(--border-strong); border-radius: 4px; padding: 1px 6px; }
.dim { color: var(--fg-dim); } .faint { color: var(--fg-faint); }
.editor.syn-error-line { }

.loading-lines { padding: 6px 10px; display: flex; flex-direction: column; gap: 7px; }
.loading-lines .ll { height: 9px; border-radius: 4px; background: var(--bg-inset); animation: llPulse 1.2s ease-in-out infinite; }
.loading-lines .ll:nth-child(2) { width: 82%; } .loading-lines .ll:nth-child(3) { width: 64%; }
@keyframes llPulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }

.drop-overlay[hidden] { display: none !important; }
.drop-overlay {
  position: fixed; inset: 0; z-index: 3000; background: rgba(53, 116, 240, .15); backdrop-filter: blur(1px);
  display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--fg);
  border: 2px dashed var(--accent); pointer-events: none;
}

/* keyboard focus ring */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .tb-search { min-width: 130px; }
  .tb-search-text { display: none; }
  .ed-shortcuts { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .titlebar-wordmark { display: none; }
  .tb-project { display: none; }
  .stripe-v { width: 22px; }
  .stripe-v .stripe-btn { padding: 4px 0; }
  .stripe-btn .sl-label { display: none; }
  .findbar { min-width: 300px; }
}
@media (max-width: 720px) {
  .sb-hide-sm { display: none !important; }
  .toolbar { gap: 2px; padding: 0 4px; }
  .tb-search { display: none; }
  .run-config .rc-name { max-width: 70px; }
}
