* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #1e1e1e; --surface: #252525; --border: #383838;
  --text: #e0e0e0; --text-dim: #888; --primary: #4fc3f7;
  --green: #4caf50; --red: #e57373; --yellow: #ffd54f;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
}
body { background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; }
#app { height: 100vh; display: flex; flex-direction: column; }

header { display: flex; align-items: center; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--border); gap: 8px; }
header h1 { font-size: 16px; font-weight: 700; }
.folder-name { color: var(--text-dim); font-size: 12px; max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-right { margin-left: auto; }
.btn { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn:hover { background: #333; }
.btn-primary { background: var(--primary); color: #000; border-color: var(--primary); font-weight: 600; }
.btn-primary:hover { background: #81d4fa; }
.btn-sm { padding: 2px 8px; font-size: 11px; }
.btn:disabled { opacity: .4; cursor: default; }

#welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 40px; }
#welcome h2 { font-size: 28px; }
#welcome p { color: var(--text-dim); max-width: 500px; text-align: center; }
#welcome ol { text-align: left; color: var(--text-dim); line-height: 2; }

#mainLayout { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

#tabs { display: flex; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 8px; }
.tab { background: none; border: none; color: var(--text-dim); padding: 8px 16px; cursor: pointer; border-bottom: 2px solid transparent; font-size: 13px; }
.tab.active { color: var(--text); border-bottom-color: var(--primary); }
.tab:disabled { opacity: .4; cursor: default; }

#tabContent { flex: 1; overflow: hidden; }
.tab-panel { display: none; height: 100%; flex-direction: column; }
.tab-panel.active { display: flex; }

.toolbar { display: flex; gap: 6px; padding: 8px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.toolbar input[type=text] { flex: 1; min-width: 120px; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 4px 8px; border-radius: 4px; }

.file-tree { flex: 1; overflow-y: auto; padding: 4px 0; }
.file-tree .entry { display: flex; align-items: center; padding: 2px 8px; cursor: default; gap: 4px; }
.file-tree .entry:hover { background: #2a2a2a; }
.file-tree .entry input[type=checkbox] { accent-color: var(--primary); }
.file-tree .entry .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-tree .entry .meta { color: var(--text-dim); font-size: 11px; white-space: nowrap; }
.file-tree .heat-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.json-output { flex: 1; overflow: auto; padding: 12px; font-family: 'Consolas', 'JetBrains Mono', monospace; font-size: 12px; white-space: pre; tab-size: 2; }

#tab-options { padding: 16px; overflow-y: auto; }
#tab-options h3 { margin: 12px 0 6px; color: var(--text-dim); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
#tab-options label { display: block; margin: 4px 0; }
#tab-options input[type=text], #tab-options textarea { background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 4px 8px; border-radius: 4px; width: 100%; max-width: 400px; }

footer { display: flex; gap: 16px; padding: 4px 12px; background: var(--surface); border-top: 1px solid var(--border); font-size: 11px; color: var(--text-dim); }
footer .msg-success { color: var(--green); }
footer .msg-error { color: var(--red); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 1000; display: flex; }
.modal-content { margin: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; width: 95vw; height: 90vh; display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.modal-header span { flex: 1; font-weight: 600; }
.modal-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 8px; gap: 6px; }
.modal-footer { display: flex; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--border); justify-content: flex-end; }

.diff-topbar { display: flex; gap: 8px; align-items: center; }
.diff-layout { flex: 1; display: flex; overflow: hidden; gap: 0; }
.diff-file-list { width: 25%; overflow-y: auto; border-right: 1px solid var(--border); padding: 4px; }
.diff-file-list .file-item { padding: 3px 6px; cursor: pointer; border-radius: 3px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diff-file-list .file-item:hover { background: #2a2a2a; }
.diff-file-list .file-item.selected { background: #333; color: var(--primary); }
.diff-divider { width: 1px; background: var(--border); }
.diff-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; padding: 0 8px; }
.diff-content #diffInfo { font-size: 12px; padding: 2px 0; }
.diff-minimap { width: 16px; position: relative; flex-shrink: 0; }

/* Synced diff */
.diff-view { flex: 1; overflow: hidden; position: relative; }
.diff-scroll { height: 100%; overflow-y: auto; }
.diff-table { display: flex; min-height: 100%; }
.diff-col { flex: 1; min-width: 0; }
.diff-col-orig { border-right: 1px solid var(--border); margin-right: -1px; }
.diff-line { display: flex; font-family: 'Consolas', 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.5; }
.diff-line .gutter { width: 44px; flex-shrink: 0; text-align: right; padding-right: 8px; color: var(--text-dim); user-select: none; }
.diff-line .content { flex: 1; white-space: pre; overflow: hidden; }
.diff-line-equal { background: transparent; }
.diff-line-insert { background: rgba(76,175,80,.15); }
.diff-line-insert .gutter { color: var(--green); }
.diff-line-delete { background: rgba(229,115,115,.15); }
.diff-line-delete .gutter { color: var(--red); }
.diff-line-empty { background: transparent; }
.diff-line-empty .content { color: var(--text-dim); }

/* Diff navigation */
.diff-nav { display: flex; align-items: center; gap: 6px; }
.diff-nav span { font-size: 12px; color: var(--text-dim); min-width: 40px; text-align: center; }
